From 3025b6049f35d0daa88304acb217a0e2a20c41b5 Mon Sep 17 00:00:00 2001 From: andrey-git Date: Sun, 5 Nov 2017 20:59:46 +0200 Subject: [PATCH] Update rules --- gulp/tasks/gen-service-worker.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/gulp/tasks/gen-service-worker.js b/gulp/tasks/gen-service-worker.js index f48848ee5b..b0d05d6f59 100755 --- a/gulp/tasks/gen-service-worker.js +++ b/gulp/tasks/gen-service-worker.js @@ -87,12 +87,12 @@ gulp.task('gen-service-worker', () => { ], // Rules are proceeded in order and negative per-domain rules are not supported. runtimeCaching: [ - { // Cache translations on first access - urlPattern: '/static/translations/*', - handler: 'cacheFirst', + { // Cache static content (including translations) on first access. + urlPattern: '/static/*', + handler: 'cacheFirst', }, - { // Get static, api, and local (and home-assistant-polymer in dev mode) from network. - urlPattern: '/(home-assistant-polymer|static|api|local)/*', + { // Get api (and home-assistant-polymer in dev mode) from network. + urlPattern: '/(home-assistant-polymer|api)/*', handler: 'networkOnly', }, { // Get manifest and service worker from network. @@ -100,10 +100,11 @@ gulp.task('gen-service-worker', () => { handler: 'networkOnly', }, { // For rest of the files (on Home Assistant domain only) try both cache and network/ + // This includes the root "/" or "/states" response and user files from ""/local". // First access might bring stale data from cache, but a single refresh will bring updated // file. urlPattern: '*', - handler: 'fastest', + handler: 'fastest', } ], stripPrefix: 'hass_frontend',