[英]PWA [sw-toolbox]: How to cache offline page with all resources?
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. 问题是,在此页面中,我有约10个js / css资源和约20个图像。 It's silly to point each one in
precache
array by hand. 手动将每个指针指向
precache
阵列是很愚蠢的。 Also, it's hard to maintain - all resource changes in html template will be affect sw.js
. 另外,很难维护
sw.js
模板中的所有资源更改都会影响sw.js
Is there a option to precache .html
page with all resources (js/css/png) ? 是否可以使用所有资源(js / css / png)预缓存
.html
页面?
No. 没有。
You would most likely want to have your build scripts include the static assets in the precache array in your SW. 您很可能希望您的构建脚本在SW的precache阵列中包含静态资产。 Not by hand.
不是用手。
I have been using Google's method for some time now and has never failed me. 我已经使用Google的方法已有一段时间了,从来没有让我失望。 SW toolbox didn't give me the results I wanted.
SW工具箱没有给我想要的结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.