Skip to content

Commit 61a0b65

Browse files
committed
feat: try to add services worker
1 parent 39c1c12 commit 61a0b65

17 files changed

+111
-7
lines changed

angular.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
"assets": [
2727
"src/favicon.ico",
2828
"src/assets",
29-
"src/README.md"
29+
"src/README.md",
30+
"src/manifest.webmanifest"
3031
],
3132
"styles": [
3233
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
@@ -75,7 +76,9 @@
7576
"maximumWarning": "6kb",
7677
"maximumError": "10kb"
7778
}
78-
]
79+
],
80+
"serviceWorker": true,
81+
"ngswConfigPath": "ngsw-config.json"
7982
}
8083
}
8184
},
@@ -108,7 +111,8 @@
108111
"karmaConfig": "karma.conf.js",
109112
"assets": [
110113
"src/favicon.ico",
111-
"src/assets"
114+
"src/assets",
115+
"src/manifest.webmanifest"
112116
],
113117
"styles": [
114118
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",

ngsw-config.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
3+
"index": "/index.html",
4+
"assetGroups": [
5+
{
6+
"name": "app",
7+
"installMode": "prefetch",
8+
"resources": {
9+
"files": [
10+
"/favicon.ico",
11+
"/index.html",
12+
"/manifest.webmanifest",
13+
"/*.css",
14+
"/*.js"
15+
]
16+
}
17+
}, {
18+
"name": "assets",
19+
"installMode": "lazy",
20+
"updateMode": "prefetch",
21+
"resources": {
22+
"files": [
23+
"/assets/**",
24+
"/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
25+
]
26+
}
27+
}
28+
]
29+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"@angular/platform-browser": "~9.0.3",
3232
"@angular/platform-browser-dynamic": "^9.1.0",
3333
"@angular/router": "~9.0.3",
34+
"@angular/service-worker": "~9.0.3",
3435
"@ledge-framework/render": "~0.0.6",
3536
"@ngx-pwa/local-storage": "^9.0.2",
3637
"@scullyio/init": "^0.0.23",

src/android-chrome-192x192.png

-27.2 KB
Binary file not shown.

src/android-chrome-512x512.png

-131 KB
Binary file not shown.

src/app/app.module.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import { registerLocaleData } from '@angular/common';
2525
import localeGb from '@angular/common/locales/en-GB';
2626
import localZhHans from '@angular/common/locales/zh-Hans';
2727
import { ScullyLibModule } from '@scullyio/ng-lib';
28+
import { ServiceWorkerModule } from '@angular/service-worker';
29+
import { environment } from '../environments/environment';
2830

2931
registerLocaleData(localeGb, 'en-gb');
3032
registerLocaleData(localZhHans, 'zh-Hans');
@@ -57,6 +59,9 @@ registerLocaleData(localZhHans, 'zh-Hans');
5759
CustomMaterialModule,
5860
LedgeRenderModule,
5961
ScullyLibModule,
62+
ServiceWorkerModule.register('ngsw-worker.js', {
63+
enabled: environment.production,
64+
}),
6065
],
6166
providers: [Title],
6267
bootstrap: [AppComponent],

src/assets/icons/icon-128x128.png

6.55 KB
Loading

src/assets/icons/icon-144x144.png

7.51 KB
Loading

src/assets/icons/icon-152x152.png

7.86 KB
Loading

src/assets/icons/icon-192x192.png

10.1 KB
Loading

0 commit comments

Comments
 (0)