PWA [sw-toolbox]: How to cache offline page with all resources?

415 Views Asked by At

I have a page which i would like to use as offline fallback.

The problem is, that in this page i have a ~10 of js/css resources and ~20 images. It's silly to point each one in precache array by hand. Also, it's hard to maintain - all resource changes in html template will be affect sw.js.

Is there a option to precache .html page with all resources (js/css/png) ?

2

There are 2 best solutions below

1
On

No.

You would most likely want to have your build scripts include the static assets in the precache array in your SW. Not by hand.

0
On

I have been using Google's method for some time now and has never failed me. SW toolbox didn't give me the results I wanted.