Skip to content

Instantly share code, notes, and snippets.

@pssubashps
Created January 23, 2018 12:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pssubashps/915c5ec284e8bb7bbe880c366ad36552 to your computer and use it in GitHub Desktop.
Save pssubashps/915c5ec284e8bb7bbe880c366ad36552 to your computer and use it in GitHub Desktop.
Sample Service worker config Angular5
{
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html",
"/siteconfig.json"
],
"versionedFiles": [
"/*.bundle.css",
"/*.bundle.js",
"/*.chunk.js"
]
}
},
{
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/**"
],
"urls":[
"https://fonts.googleapis.com/**"
]
}
}
],
"dataGroups": [
{
"name": "api-performance",
"urls": [
"siteconfig.json",
"/assets/languages/en.json"
],
"cacheConfig": {
"maxSize": 100,
"maxAge": "1d",
"strategy": "performance"
}
},
{
"name": "api-freshness",
"urls": [
"/tenants",
"/resourceGroups",
"/roles"
],
"cacheConfig": {
"maxSize": 100,
"maxAge": "1h",
"timeout": "5s",
"strategy": "freshness"
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment