Skip to content

Commit

Permalink
Install PWA package and cache the data URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
Popovkov57 committed Sep 30, 2022
1 parent 2819055 commit 8f3a440
Show file tree
Hide file tree
Showing 15 changed files with 316 additions and 172 deletions.
10 changes: 7 additions & 3 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@
"tsConfig": "tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
"src/assets",
"src/manifest.webmanifest"
],
"styles": [
"src/styles.css",
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"node_modules/font-awesome/css/font-awesome.min.css"
],
"scripts": []
"scripts": [],
"serviceWorker": true,
"ngswConfigPath": "ngsw-config.json"
},
"configurations": {
"production": {
Expand Down Expand Up @@ -89,7 +92,8 @@
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
"src/assets",
"src/manifest.webmanifest"
],
"styles": [
"src/styles.css"
Expand Down
42 changes: 42 additions & 0 deletions ngsw-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html",
"/manifest.webmanifest",
"/*.css",
"/*.js"
]
}
},
{
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/**",
"/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)",
"/font/"
]
}
}
],
"dataGroups": [
{
"name": "api-product",
"urls": ["/api/products"],
"cacheConfig": {
"maxSize": 100,
"maxAge": "5d"
}
}
],
"navigationUrls": ["/**"]
}
Loading

0 comments on commit 8f3a440

Please sign in to comment.