Skip to content

Instantly share code, notes, and snippets.

@AlbertoBasalo
Created October 28, 2022 09:18
Show Gist options
  • Save AlbertoBasalo/b984995211c9556234138bcd7a8159a3 to your computer and use it in GitHub Desktop.
Save AlbertoBasalo/b984995211c9556234138bcd7a8159a3 to your computer and use it in GitHub Desktop.
Angular PWA configuration file
{
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
"index": "/index.html",
"appData": {
"version": "1.2.3",
"description": "feat: 🌅 less bugs more features"
},
"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)"
]
}
}
],
"dataGroups": [
{
"name": "stable-cache-first",
"cacheConfig": {
"strategy": "performance",
"maxAge": "1d",
"maxSize": 10
},
"urls": ["http://api.yourserver.com/countries"]
},
{
"name": "dynamic-network-first",
"cacheConfig": {
"strategy": "freshness",
"maxAge": "1h",
"maxSize": 10,
"timeout": "10s"
},
"urls": ["http://api.yourserver.com/moneyquotes"]
},
{
"name": "stale-while-revalidating",
"cacheConfig": {
"strategy": "freshness",
"maxAge": "1h",
"maxSize": 10,
"timeout": "0u"
},
"urls": ["http://api.yourserver.com/population"]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment