Update rules

This commit is contained in:
andrey-git 2017-11-05 20:59:46 +02:00
parent db9dc653e0
commit 3025b6049f

View File

@ -87,12 +87,12 @@ gulp.task('gen-service-worker', () => {
], ],
// Rules are proceeded in order and negative per-domain rules are not supported. // Rules are proceeded in order and negative per-domain rules are not supported.
runtimeCaching: [ runtimeCaching: [
{ // Cache translations on first access { // Cache static content (including translations) on first access.
urlPattern: '/static/translations/*', urlPattern: '/static/*',
handler: 'cacheFirst', handler: 'cacheFirst',
}, },
{ // Get static, api, and local (and home-assistant-polymer in dev mode) from network. { // Get api (and home-assistant-polymer in dev mode) from network.
urlPattern: '/(home-assistant-polymer|static|api|local)/*', urlPattern: '/(home-assistant-polymer|api)/*',
handler: 'networkOnly', handler: 'networkOnly',
}, },
{ // Get manifest and service worker from network. { // Get manifest and service worker from network.
@ -100,10 +100,11 @@ gulp.task('gen-service-worker', () => {
handler: 'networkOnly', handler: 'networkOnly',
}, },
{ // For rest of the files (on Home Assistant domain only) try both cache and network/ { // 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 // First access might bring stale data from cache, but a single refresh will bring updated
// file. // file.
urlPattern: '*', urlPattern: '*',
handler: 'fastest', handler: 'fastest',
} }
], ],
stripPrefix: 'hass_frontend', stripPrefix: 'hass_frontend',