Open vdias38 opened 5 years ago
imgcache.js is not well supported and not seems to be a future-proof way.
$ npm install --save ionic-image-loader
Import IonicImageLoader
on home module
On /pages/home/home.html replace
<img src="./assets/images/header-clean.png" class="logo" alt="infomobi">
By <img-loader [src]="settings.logoUrl" fallbackUrl="./assets/images/header-clean.png" fallbackAsPlaceholder="true" useImg [imgAttributes]="imageAttributes"></img-loader>
OR set by default settings.logoUrl = "./assets/images/header-clean.png"
Where
import { ImageAttribute } from 'ionic-image-loader'
const imageAttributes: ImageAttribute[] = [];
imageAttributes.push({
element: 'class',
value: 'logo'
})
to allow PWA caching we should define an url pattern
By default any images under ./assets are cached by angular sw
Should add a new AssetGroup to cache uploads img from meumobi
, {
"name": "uploads",
"installMode": "lazy",
"updateMode": "lazy",
"resources": {
"urls": [
"/uploads/**"
]
},
"cacheConfig": {
"maxSize": 250,
"maxAge": "7d"
}