From be4747861e02d60f7d0d0429e75aaee906d34fa7 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Sun, 20 Jan 2019 13:09:38 -0500 Subject: [PATCH] update readme for current app structure --- README.md | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 369a775..d120200 100644 --- a/README.md +++ b/README.md @@ -16,30 +16,18 @@ Open up [localhost:3000](http://localhost:3000) and start clicking around. Consult [sapper.svelte.technology](https://sapper.svelte.technology) for help getting started. + ## Structure -Sapper expects to find three directories in the root of your project — `app`, `assets` and `routes`. +Sapper expects to find two directories in the root of your project — `src` and `static`. -### app +### src -The [app](app) directory contains the entry points for your app — `client.js`, `server.js` and (optionally) a `service-worker.js` — along with a `template.html` file. +The [src](src) directory contains the entry points for your app — `client.js`, `server.js` and (optionally) a `service-worker.js` — along with a `template.html` file and a `routes` directory. -### assets - -The [assets](assets) directory contains any static assets that should be available. These are served using [sirv](https://github.com/lukeed/sirv). - -In your [service-worker.js](app/service-worker.js) file, you can import these as `assets` from the generated manifest... - -```js -import { assets } from './manifest/service-worker.js'; -``` - -...so that you can cache them (though you can choose not to, for example if you don't want to cache very large files). - - -### routes +#### src/routes This is the heart of your Sapper app. There are two kinds of routes — *pages*, and *server routes*. @@ -49,9 +37,22 @@ This is the heart of your Sapper app. There are two kinds of routes — *pages*, There are three simple rules for naming the files that define your routes: -* A file called `routes/about.html` corresponds to the `/about` route. A file called `routes/blog/[slug].html` corresponds to the `/blog/:slug` route, in which case `params.slug` is available to the route -* The file `routes/index.html` (or `routes/index.js`) corresponds to the root of your app. `routes/about/index.html` is treated the same as `routes/about.html`. -* Files and directories with a leading underscore do *not* create routes. This allows you to colocate helper modules and components with the routes that depend on them — for example you could have a file called `routes/_helpers/datetime.js` and it would *not* create a `/_helpers/datetime` route +* A file called `src/routes/about.html` corresponds to the `/about` route. A file called `src/routes/blog/[slug].html` corresponds to the `/blog/:slug` route, in which case `params.slug` is available to the route +* The file `src/routes/index.html` (or `src/routes/index.js`) corresponds to the root of your app. `src/routes/about/index.html` is treated the same as `src/routes/about.html`. +* Files and directories with a leading underscore do *not* create routes. This allows you to colocate helper modules and components with the routes that depend on them — for example you could have a file called `src/routes/_helpers/datetime.js` and it would *not* create a `/_helpers/datetime` route + + +### static + +The [static](static) directory contains any static assets that should be available. These are served using [sirv](https://github.com/lukeed/sirv). + +In your [service-worker.js](app/service-worker.js) file, you can import these as `files` from the generated manifest... + +```js +import { files } from '../__sapper__/service-worker.js'; +``` + +...so that you can cache them (though you can choose not to, for example if you don't want to cache very large files). ## Bundler config