angular / mobile-toolkit

Tools for building progressive web apps with Angular
MIT License
1.34k stars 175 forks source link

cache settings depending on browser #169

Open maciejtreder opened 7 years ago

maciejtreder commented 7 years ago

This is feature request, not a bug.

It would be great, if user could specify what kind of data should be fetch for given browser type. It could be specified in ngsw_manifest.json file:

{
  "fetch.rules": [
    { "rule": "image/webp", "browsers": ["chrome"]}, //fetch data only for chrome
    { "rule": "image/png", "browsers": ["safari", "firefox"]}, //fetch data only for safari and firefox
    { "rule": "image/jpg", "browsers": ["^chrome", "^opera"]} //fetch data for every browser which is not chrome or opera
  ]
}

Purpose of this update is that different browsers supports different sets of data. For example, only few browser suppor webp format. At this moment developers can create fallbacks in html and css (more about those here: https://css-tricks.com/using-webp-images/). But there is no fallback for this angular functionality.

Such feature, would be a great opportunity to avoid high origin load when service workes is downloading never-used files