Skip to content

Commit b8e34a6

Browse files
committed
Add pwa support
1 parent f3a997d commit b8e34a6

File tree

5 files changed

+2757
-2532
lines changed

5 files changed

+2757
-2532
lines changed

public/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">
66
<meta name="viewport" content="width=device-width,initial-scale=1.0">
7+
<meta name="theme-color" content="#00142A">
78
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
89
<title>sub-web</title>
910
</head>

public/manifest.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"short_name": "sub-web",
3+
"name": "sub-web",
4+
"icon": [
5+
{
6+
"src": "./img/icons/icon-192x192.png",
7+
"sizes": "192x192",
8+
"type": "image/png"
9+
},
10+
{
11+
"src": "./img/icons/android-chrome-512x512.png",
12+
"sizes": "512x512",
13+
"type": "image/png"
14+
}
15+
],
16+
"start_url": "index.html",
17+
"display": "standalone",
18+
"background_color": "#002140",
19+
"theme_color": "#002140"
20+
}

src/registerServiceWorker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { register } from 'register-service-worker'
44

55
if (process.env.NODE_ENV === 'production') {
6-
register(`${process.env.BASE_URL}service-worker.js`, {
6+
register(`${process.env.BASE_URL}sub-web.js`, {
77
ready () {
88
console.log(
99
'App is being served from cache by a service worker.\n' +

vue.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,17 @@ module.exports = {
3030
symbolId: 'icon-[name]'
3131
})
3232
.end()
33+
},
34+
35+
pwa: {
36+
workboxOptions: {
37+
// https://developers.google.com/web/tools/workbox/modules/workbox-webpack-plugin
38+
skipWaiting: true,
39+
clientsClaim: true,
40+
importWorkboxFrom: 'local',
41+
importsDirectory: 'js',
42+
navigateFallback: '/',
43+
navigateFallbackBlacklist: [/\/api\//]
44+
}
3345
}
3446
};

0 commit comments

Comments
 (0)