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
[](https://deploy.now.sh/?repo=https://github.com/zeit/next.js/tree/master/examples/with-sw-precache)
2
+
3
+
# sw-precache example
4
+
5
+
## How to use
6
+
7
+
Download the example [or clone the repo](https://github.com/zeit/next.js):
8
+
9
+
```bash
10
+
curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/with-sw-precache
11
+
cd with-sw-precache
12
+
```
13
+
14
+
Install it and run:
15
+
16
+
```bash
17
+
npm install
18
+
npm run build
19
+
npm start
20
+
```
21
+
22
+
Deploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.co/download))
23
+
24
+
```bash
25
+
now
26
+
```
27
+
28
+
## The idea behind the example
29
+
30
+
You'll often want your Service Worker to be registered at the root level to give it access to your whole application.
31
+
32
+
This example shows how this can be achieved alongside [sw-precache](https://github.com/GoogleChrome/sw-precache) (via [the webpack plugin](https://github.com/goldhand/sw-precache-webpack-plugin)).
0 commit comments