mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-17 13:14:54 +00:00
move old docs over
This commit is contained in:
@@ -82,7 +82,7 @@ In addition to `child.component` and `child.props`, there is a `child.segment` p
|
||||
```
|
||||
|
||||
|
||||
### Preloading
|
||||
### Preloading in layouts
|
||||
|
||||
Like page components, layout components can use `preload`:
|
||||
|
||||
@@ -10,11 +10,11 @@ Until we reach version 1.0, there may be occasional changes to the project struc
|
||||
Consult [sapper-template](https://github.com/sveltejs/sapper-template) for full examples of all the below points.
|
||||
|
||||
|
||||
#### package.json
|
||||
##### package.json
|
||||
|
||||
To start a dev server, use `sapper dev` rather than `node server.js`. In all likelihood, your package.json will have an `npm run dev` script that will need to be updated.
|
||||
|
||||
#### Entry points
|
||||
##### Entry points
|
||||
|
||||
As of version 0.7, Sapper expects to find your entry points — for client, server and service worker — in an `app` folder. Instead of using magically-injected `__variables__`, each entry point imports from its corresponding file in the `app/manifests` folder. These are automatically generated by Sapper.
|
||||
|
||||
@@ -50,7 +50,7 @@ import { assets, shell, timestamp, routes } from './manifest/service-worker.js';
|
||||
```
|
||||
|
||||
|
||||
#### Templates and error pages
|
||||
##### Templates and error pages
|
||||
|
||||
In previous versions, we had `templates/2xx.html`, `templates/4xx.html` and `templates/5xx.html`. Now, we have a single template, `app/template.html`, which should look like your old `templates/2xx.html`.
|
||||
|
||||
@@ -61,7 +61,7 @@ This page is just like any other, except that it will get rendered whenever an e
|
||||
Note that you can now use `this.error(statusCode, error)` inside your `preload` functions.
|
||||
|
||||
|
||||
#### Webpack configs
|
||||
##### Webpack configs
|
||||
|
||||
Your webpack configs now live in a `webpack` directory:
|
||||
|
||||
@@ -73,12 +73,12 @@ If you have a service worker, you should also have a `webpack/service-worker.con
|
||||
|
||||
### <0.9 to 0.10
|
||||
|
||||
#### app/template.html
|
||||
##### app/template.html
|
||||
|
||||
* Your `<head>` element must contain `%sapper.base%` (see ([base URLs](guide#base-urls))
|
||||
* Remove references to your service worker; this is now handled by `%sapper.scripts%`
|
||||
|
||||
#### Pages
|
||||
##### Pages
|
||||
|
||||
* Your `preload` functions should now use `this.fetch` instead of `fetch`. `this.fetch` allows you to make credentialled requests on the server, and means that you no longer need to create a `global.fetch` object in `app/server.js`.
|
||||
|
||||
Reference in New Issue
Block a user