You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/docs/00-introduction.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ title: Introduction
12
12
13
13
SvelteKit is a framework for building extremely high-performance web apps.
14
14
15
-
Building an app with all the modern best practices is fiendishly complicated. Those practices include [build optimizations](https://vitejs.dev/guide/features.html#build-optimizations), so that you load only the minimal required code; [offline support](/docs/service-workers); [prefetching](/docs/a-options#sveltekit-prefetch) pages before the user initiates navigation; and [configurable rendering](/docs/page-options) that allows you to generate HTML [on the server](/docs/appendix#ssr) or [in the browser](/docs/page-options#router) at runtime or [at build-time](/docs/page-options#prerender). SvelteKit does all the boring stuff for you so that you can get on with the creative part.
15
+
Building an app with all the modern best practices is fiendishly complicated. Those practices include [build optimizations](https://vitejs.dev/guide/features.html#build-optimizations), so that you load only the minimal required code; [offline support](/docs/service-workers); [prefetching](/docs/a-options#sveltekit-prefetch) pages before the user initiates navigation; and [configurable rendering](/docs/page-options) that allows you to render your app [on the server](/docs/appendix#ssr) or [in the browser](/docs/appendix#csr) at runtime or [at build-time](/docs/page-options#prerender). SvelteKit does all the boring stuff for you so that you can get on with the creative part.
16
16
17
17
It uses [Vite](https://vitejs.dev/) with a [Svelte plugin](https://github.com/sveltejs/vite-plugin-svelte) to provide a lightning-fast and feature-rich development experience with [Hot Module Replacement (HMR)](https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#hot), where changes to your code are reflected in the browser instantly.
During client-side navigation, SvelteKit will load this data from the server, which means that the returned value must be serializable using [devalue](https://github.com/rich-harris/devalue).
113
112
114
-
Like `+page.js`, `+page.server.js` can export [page options](/docs/page-options) — `prerender`, `hydrate`, `router`and `ssr`.
113
+
Like `+page.js`, `+page.server.js` can export [page options](/docs/page-options) — `prerender`, `ssr`and `csr`.
115
114
116
115
#### Actions
117
116
@@ -282,7 +281,7 @@ export function load() {
282
281
}
283
282
```
284
283
285
-
If a `+layout.js` exports [page options](/docs/page-options) — `prerender`, `hydrate``router`and `ssr` — they will be used as defaults for child pages.
284
+
If a `+layout.js` exports [page options](/docs/page-options) — `prerender`, `ssr`and `csr` — they will be used as defaults for child pages.
286
285
287
286
Data returned from a layout's `load` function is also available to all its child pages:
288
287
@@ -302,7 +301,7 @@ Data returned from a layout's `load` function is also available to all its child
302
301
303
302
To run your layout's `load` function on the server, move it to `+layout.server.js`, and change the `LayoutLoad` type to `LayoutServerLoad`.
304
303
305
-
Like `+layout.js`, `+layout.server.js` can export [page options](/docs/page-options) — `prerender`, `hydrate``router`and `ssr`.
304
+
Like `+layout.js`, `+layout.server.js` can export [page options](/docs/page-options) — `prerender`, `ssr`and `csr`.
Copy file name to clipboardExpand all lines: documentation/docs/09-a-options.md
-2Lines changed: 0 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,8 +16,6 @@ We can mitigate that by _prefetching_ the data. Adding a `data-sveltekit-prefetc
16
16
17
17
...will cause SvelteKit to run the page's `load` function as soon as the user hovers over the link (on a desktop) or touches it (on mobile), rather than waiting for the `click` event to trigger navigation. Typically, this buys us an extra couple of hundred milliseconds, which is the difference between a user interface that feels laggy, and one that feels snappy.
18
18
19
-
Note that prefetching will not work if the [`router`](/docs/page-options#router) setting is `false`.
20
-
21
19
You can also programmatically invoke `prefetch` from `$app/navigation`.
Copy file name to clipboardExpand all lines: documentation/docs/12-page-options.md
+9-20Lines changed: 9 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,35 +68,24 @@ For that reason among others, it's recommended that you always include a file ex
68
68
69
69
For _pages_, we skirt around this problem by writing `foo/index.html` instead of `foo`.
70
70
71
-
### hydrate
72
-
73
-
Ordinarily, SvelteKit [hydrates](/docs/appendix#hydration) your server-rendered HTML into an interactive page. Some pages don't require JavaScript at all — many blog posts and 'about' pages fall into this category. In these cases you can skip hydration through the `hydrate` export:
74
-
75
-
```js
76
-
/// file: +page.js
77
-
exportconsthydrate=false;
78
-
```
79
-
80
-
> If `hydrate` and `router` are both `false`, SvelteKit will not add any JavaScript to the page at all. If [server-side rendering](/docs/hooks#handle) is disabled in `handle`, `hydrate` must be `true` or no content will be rendered.
81
-
82
-
### router
71
+
Note that this will disable client-side routing for any navigation from this page, regardless of whether the router is already active.
83
72
84
-
SvelteKit includes a [client-side router](/docs/appendix#routing) that intercepts navigations (from the user clicking on links, or interacting with the back/forward buttons) and updates the page contents, rather than letting the browser handle the navigation by reloading.
73
+
### ssr
85
74
86
-
In certain circumstances you might need to disable [client-side routing](/docs/appendix#routing) through the `router` export:
75
+
Normally, SvelteKit renders your page on the server first and sends that HTML to the client where it's hydrated. If you set `ssr` to `false`, it renders an empty 'shell' page instead. This is useful if your page is unable to be rendered on the server, but in most situations it's not recommended ([see appendix](/docs/appendix#ssr)).
87
76
88
77
```js
89
78
/// file: +page.js
90
-
exportconstrouter=false;
79
+
exportconstssr=false;
91
80
```
92
81
93
-
Note that this will disable client-side routing for any navigation from this page, regardless of whether the router is already active.
82
+
### csr
94
83
95
-
### ssr
96
-
97
-
Normally, SvelteKit renders your page on the server first and sends that HTML to the client where it's hydrated. If you set `ssr` to `false`, it renders an empty 'shell' page instead. This is useful if your page accesses browser-only methods or objects, but in most situations it's not recommended ([see appendix](/docs/appendix#ssr)).
84
+
Ordinarily, SvelteKit [hydrates](/docs/appendix#hydration) your server-rendered HTML into an interactive client-side-rendered (CSR) page. Some pages don't require JavaScript at all — many blog posts and 'about' pages fall into this category. In these cases you can disable CSR:
98
85
99
86
```js
100
87
/// file: +page.js
101
-
exportconstssr=false;
88
+
exportconstcsr=false;
102
89
```
90
+
91
+
> If both `ssr` and `csr` are `false`, nothing will be rendered!
0 commit comments