Skip to content

Latest commit

 

History

History
58 lines (34 loc) · 1.43 KB

README.md

File metadata and controls

58 lines (34 loc) · 1.43 KB

sapper-template

The default Sapper template, available for Rollup and webpack.

Getting started

Using degit

degit is a scaffolding tool that lets you create a directory from a branch in a repository. Use either the rollup or webpack branch in sapper-template:

# for Rollup
npx degit "sveltejs/sapper-template#rollup" my-app
# for webpack
npx degit "sveltejs/sapper-template#webpack" my-app

Running the project

However you get the code, you can install dependencies and run the project in development mode with:

cd my-app
npm install # or yarn
npm run dev

Open up localhost:3000 and start clicking around.

Consult sapper.svelte.dev for help getting started.

Set up environment variables

  1. Create a .env file:
NEWSLETTER_API_TOKEN=XXX
  1. Include it in .gitignore so you don't commit it accidentally

  2. Install dotenv package

yarn add dotenv
  1. Bootstrap dotenv in drc/server.js file

  2. Add NEWSLETTER_API_TOKEN in session by using sapper.middleware

  3. You can check how you can access NEWSLETTER_API_TOKEN in preload function of src/routes/index.svelte page component

  4. You can check how you can access NEWSLETTER_API_TOKEN through session store across every component in src/components/Nav.svelte component