Compare commits

...
5 changed files with 10 additions and 1 deletions

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

+9
View File
@@ -235,6 +235,15 @@ function updateServiceWorkerCache() {
for (const name of Object.keys(bundles)) {
hash.update(fs.readFileSync(path.join(DIST, name)));
}
// DC-171-UX: assets participate in the cache tag too — an asset-only
// change (logo fix, icon swap) must bust the SW cache as well, otherwise
// runtime-cached images stay stale until the cache dies of old age.
const ASSET_EXTENSIONS = /\.(png|svg|ico|css|webmanifest)$/;
const assetDir = path.join(__dirname, 'assets');
for (const f of fs.readdirSync(assetDir).filter((f) => ASSET_EXTENSIONS.test(f)).sort()) {
hash.update(f);
hash.update(fs.readFileSync(path.join(assetDir, f)));
}
const tag = hash.digest('hex').slice(0, 10);
const updated = sw.replace(
/const CACHE = 'dashcaddy-shell-[^']+';/,
+1 -1
View File
@@ -1,4 +1,4 @@
const CACHE = 'dashcaddy-shell-7915de22e8';
const CACHE = 'dashcaddy-shell-0fa5717320';
const PRECACHE = [
'/',
'/index.html',