From 1089485714dc1ee66c2b96e1b34f8881aaa0c4d2 Mon Sep 17 00:00:00 2001 From: Eric Jinks Date: Fri, 2 Feb 2018 15:27:50 +1000 Subject: [PATCH] Add /images/ to runtimeCaching --- sw-precache-config.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sw-precache-config.js b/sw-precache-config.js index 0f714a1..5675ca0 100644 --- a/sw-precache-config.js +++ b/sw-precache-config.js @@ -16,8 +16,19 @@ module.exports = { // any external urls you wish to cache (e.g. CDN) runtimeCaching: [ { + // cache content from external url as they are loaded by browser urlPattern: /^https?:\/\/.*example-cdn.com/, handler: 'cacheFirst' + }, + { + // cache files in the images directory as they are loaded by browser + urlPattern: '/images/(.*)', + handler: 'cacheFirst', + options: { + cache: { + name: 'images-cache' + } + } } ] }