Skip to content

Commit edda505

Browse files
committed
Service worker, Web App Manifest, gh-pages deployment
1 parent 375bbfe commit edda505

File tree

4 files changed

+30
-4
lines changed

4 files changed

+30
-4
lines changed

favicon.ico

-14.3 KB
Binary file not shown.

index.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<head>
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<link rel="manifest" href="manifest.json">
67
<title>React App</title>
78
</head>
89
<body>
@@ -17,5 +18,13 @@
1718
To begin the development, run `npm start` in this folder.
1819
To create a production bundle, use `npm run build`.
1920
-->
21+
<script>
22+
if ('serviceWorker' in navigator) {
23+
navigator.serviceWorker.register('service-worker.js').catch(function(ex) {
24+
console.warn(ex);
25+
console.warn('(This warning can be safely ignored outside of the production build.)');
26+
});
27+
}
28+
</script>
2029
</body>
2130
</html>

manifest.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"short_name": "create-react-pwa",
3+
"name": "Create React PWApp",
4+
"icons": [
5+
{
6+
"src": "favicon.ico",
7+
"sizes": "192x192",
8+
"type": "image/png"
9+
}
10+
],
11+
"start_url": "/",
12+
"display": "standalone"
13+
}

package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,22 @@
33
"version": "0.0.1",
44
"private": true,
55
"devDependencies": {
6-
"react-scripts": "0.2.1"
6+
"gh-pages": "^0.11.0",
7+
"react-scripts": "0.2.1",
8+
"sw-precache": "^4.0.0"
79
},
810
"dependencies": {
911
"react": "^15.2.1",
1012
"react-dom": "^15.2.1"
1113
},
1214
"scripts": {
1315
"start": "react-scripts start",
14-
"build": "react-scripts build",
16+
"build": "react-scripts build && cp manifest.json build/ && sw-precache --root='build/' --static-file-globs='build/**/!(*map*)'",
17+
"gh-pages": "gh-pages -d build",
1518
"eject": "react-scripts eject"
1619
},
1720
"eslintConfig": {
1821
"extends": "./node_modules/react-scripts/config/eslint.js"
19-
}
20-
}
22+
},
23+
"homepage": "./"
24+
}

0 commit comments

Comments
 (0)