From 3734163bbac6eaf7562b86fd3f5b5c863515dcc6 Mon Sep 17 00:00:00 2001 From: James Fenn Date: Tue, 5 Jan 2021 15:26:35 -0500 Subject: [PATCH] add version number to cache names --- meta/sw.js.njk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/meta/sw.js.njk b/meta/sw.js.njk index c35baba..15f8ed2 100644 --- a/meta/sw.js.njk +++ b/meta/sw.js.njk @@ -4,6 +4,8 @@ eleventyExcludeFromCollections: true --- importScripts('https://storage.googleapis.com/workbox-cdn/releases/3.6.1/workbox-sw.js'); +const _version = '-1'; + if (workbox) { workbox.precaching.precacheAndRoute([]); @@ -35,7 +37,7 @@ if (workbox) { // Cache CSS files /.*\.css/, workbox.strategies.staleWhileRevalidate({ - cacheName: 'css-cache', + cacheName: 'css-cache' + _version, }) ); @@ -43,7 +45,7 @@ if (workbox) { // Cache image files /.*\.(?:png|jpg|jpeg|svg|gif)/, workbox.strategies.cacheFirst({ - cacheName: 'image-cache', + cacheName: 'image-cache' + _version, plugins: [ new workbox.expiration.Plugin({ maxEntries: 100, -- GitLab