super-productivity/ngsw-config.json
Johannes Millan 86357f705a fix(pwa): cache the hashed icon font so it renders offline on iOS #8138
In production the esbuild builder fingerprints the @font-face url() and
emits the Material Symbols woff2 to /media/<hash>.woff2, but ngsw-config
only precached the unhashed /assets/fonts copy that nothing loads. The
font the app actually requests was therefore never in the service worker
cache and failed to load offline, leaving icons as their ligature names
(wb_sunny, settings, ...). iOS Safari surfaces this first because, unlike
Chrome, it does not fall back to the HTTP disk cache offline.

- prefetch /media/material-symbols-outlined-*.woff2 (the URL @font-face
  actually requests)
- lazily cache the rest of /media (self-hosted Open Sans) so offline text
  also keeps its font
- font-display: block so the brief load window shows blank glyph space
  rather than the ligature names
2026-06-08 18:29:55 +02:00

60 lines
1.4 KiB
JSON

{
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": ["/favicon.ico", "/index.html", "/manifest.json", "/*.css", "/*.js"]
}
},
{
"name": "criticalAssets",
"installMode": "prefetch",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/icons/*.svg",
"/assets/icons/icon-*.png",
"/assets/icons/favicon-*.png",
"/assets/i18n/en.json",
"/media/material-symbols-outlined-*.woff2",
"/*.(otf|ttf|woff|woff2)"
]
}
},
{
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": ["/assets/**", "/media/**"]
}
},
{
"name": "externalAssets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"urls": ["**/*.(png|jpg|jpeg|gif)"]
}
}
],
"dataGroups": [
{
"name": "api-freshness",
"urls": [
"https://api.github.com/**",
"https://gitlab.com/api/**",
"https://*.atlassian.net/**"
],
"cacheConfig": {
"strategy": "freshness",
"maxSize": 10,
"maxAge": "1h",
"timeout": "10s"
}
}
]
}