From 4c5d85746c2304ef3dabf5ebcdff24c44b9b5dd2 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 11 Feb 2018 09:01:17 -0800 Subject: [PATCH] Fingerprint charts (#883) * Fingerprint charts URL * cache in service worker --- gulp/tasks/build.js | 1 - gulp/tasks/gen-index-html.js | 1 + gulp/tasks/gen-service-worker.js | 2 ++ gulp/tasks/rollup.js | 1 - index.html | 1 + js/core.js | 1 - src/components/entity/ha-chart-base.html | 3 +-- 7 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gulp/tasks/build.js b/gulp/tasks/build.js index 396a72fb37..cbd546755c 100644 --- a/gulp/tasks/build.js +++ b/gulp/tasks/build.js @@ -36,7 +36,6 @@ function build(es6) { stripImportsStrategy([ 'bower_components/font-roboto/roboto.html', 'bower_components/paper-styles/color.html', - 'src/resources/ha-chart-scripts.html', ]), stripAllButEntrypointStrategy('panels/hassio/ha-panel-hassio.html') ]); diff --git a/gulp/tasks/gen-index-html.js b/gulp/tasks/gen-index-html.js index 37567bb221..4b91a9ac8f 100644 --- a/gulp/tasks/gen-index-html.js +++ b/gulp/tasks/gen-index-html.js @@ -9,6 +9,7 @@ const { minifyStream } = require('../common/transform'); const buildReplaces = { '/home-assistant-polymer/build/core.js': 'core.js', '/home-assistant-polymer/src/home-assistant.html': 'frontend.html', + '/home-assistant-polymer/src/resources/ha-chart-scripts.html': 'ha-chart-scripts.html', }; function generateIndex(es6) { diff --git a/gulp/tasks/gen-service-worker.js b/gulp/tasks/gen-service-worker.js index 9e3eaa9ca7..241637e10f 100755 --- a/gulp/tasks/gen-service-worker.js +++ b/gulp/tasks/gen-service-worker.js @@ -30,12 +30,14 @@ const staticFingerprinted = [ const staticFingerprintedEs6 = [ 'core.js', 'frontend.html', + 'ha-chart-scripts.html', ]; const staticFingerprintedEs5 = [ 'compatibility.js', 'core.js', 'frontend.html', + 'ha-chart-scripts.html', ]; // These panels will always be registered inside HA and thus can diff --git a/gulp/tasks/rollup.js b/gulp/tasks/rollup.js index 07d3c5ee16..16f6803208 100644 --- a/gulp/tasks/rollup.js +++ b/gulp/tasks/rollup.js @@ -58,7 +58,6 @@ function getRollupInputOptions(es6) { __DEMO__: JSON.stringify(DEMO), __BUILD__: JSON.stringify(es6 ? 'latest' : 'es5'), __VERSION__: JSON.stringify(VERSION), - __ROOT__: JSON.stringify(es6 ? 'frontend_latest' : 'frontend_es5'), }, }), ], diff --git a/index.html b/index.html index ffc1aaa818..0185491466 100644 --- a/index.html +++ b/index.html @@ -96,6 +96,7 @@ navigator.serviceWorker.register('/service_worker.js'); }); } + window.CHART_SCRIPT = '/home-assistant-polymer/src/resources/ha-chart-scripts.html'; diff --git a/js/core.js b/js/core.js index 9367a03597..31a0434dd4 100644 --- a/js/core.js +++ b/js/core.js @@ -5,7 +5,6 @@ window.HASS_DEMO = __DEMO__; window.HASS_DEV = __DEV__; window.HASS_BUILD = __BUILD__; window.HASS_VERSION = __VERSION__; -window.HASS_ROOT = __ROOT__; const init = window.createHassConnection = function (password) { const proto = window.location.protocol === 'https:' ? 'wss' : 'ws'; diff --git a/src/components/entity/ha-chart-base.html b/src/components/entity/ha-chart-base.html index 4e7b55da31..5864ef974d 100644 --- a/src/components/entity/ha-chart-base.html +++ b/src/components/entity/ha-chart-base.html @@ -1,5 +1,4 @@ -