[英]Cache Icons Ionic PWA Angular
I was wondering if someone can help me.我想知道是否有人可以帮助我。 Im developing a PWA using Ionic + Angular and hosting it using Firebase.
我使用 Ionic + Angular 开发 PWA 并使用 Firebase 托管它。 The fact is when i lose internet, ionic icons desapired... I can't figuered it out how to modify my ngsw-config.json to get it works..
事实是,当我失去互联网时,离子图标就绝望了......我无法弄清楚如何修改我的 ngsw-config.json 以使其正常工作......
Here is my Service Worker Configuration file这是我的 Service Worker 配置文件
{
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/assets/fonts/*",
"node_modules/videogular2/fonts/videogular.css",
"/index.html",
"/*.css",
"/*.js"
]
}
}, {
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/**",
"/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
]
}
}
]
}
Add a new section or extend existing like this:添加一个新部分或像这样扩展现有部分:
{
"name": "icons",
"installMode": "prefetch", // Download as soon as possible, may cause big net usage
"updateMode": "prefetch", // Use cached version
"resources": {
"files": [
"/svg/*.svg", // Path or template for your icons (Fetches all of it)
"/svg/concrete.svg" // You may use concrete ones only
]
}
}
If you have a large library of icons may be better to specify which should be available when the app in offline mode.如果您有大量的图标库,最好指定当应用程序处于离线模式时哪些应该可用。 More info you can find here Angular service-worker configuration guide
您可以在此处找到更多信息Angular service-worker configuration guide
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.