mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-14 04:46:34 +00:00
Fingerprint charts (#883)
* Fingerprint charts URL * cache in service worker
This commit is contained in:
parent
b6ad4edd32
commit
4c5d85746c
@ -36,7 +36,6 @@ function build(es6) {
|
|||||||
stripImportsStrategy([
|
stripImportsStrategy([
|
||||||
'bower_components/font-roboto/roboto.html',
|
'bower_components/font-roboto/roboto.html',
|
||||||
'bower_components/paper-styles/color.html',
|
'bower_components/paper-styles/color.html',
|
||||||
'src/resources/ha-chart-scripts.html',
|
|
||||||
]),
|
]),
|
||||||
stripAllButEntrypointStrategy('panels/hassio/ha-panel-hassio.html')
|
stripAllButEntrypointStrategy('panels/hassio/ha-panel-hassio.html')
|
||||||
]);
|
]);
|
||||||
|
@ -9,6 +9,7 @@ const { minifyStream } = require('../common/transform');
|
|||||||
const buildReplaces = {
|
const buildReplaces = {
|
||||||
'/home-assistant-polymer/build/core.js': 'core.js',
|
'/home-assistant-polymer/build/core.js': 'core.js',
|
||||||
'/home-assistant-polymer/src/home-assistant.html': 'frontend.html',
|
'/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) {
|
function generateIndex(es6) {
|
||||||
|
@ -30,12 +30,14 @@ const staticFingerprinted = [
|
|||||||
const staticFingerprintedEs6 = [
|
const staticFingerprintedEs6 = [
|
||||||
'core.js',
|
'core.js',
|
||||||
'frontend.html',
|
'frontend.html',
|
||||||
|
'ha-chart-scripts.html',
|
||||||
];
|
];
|
||||||
|
|
||||||
const staticFingerprintedEs5 = [
|
const staticFingerprintedEs5 = [
|
||||||
'compatibility.js',
|
'compatibility.js',
|
||||||
'core.js',
|
'core.js',
|
||||||
'frontend.html',
|
'frontend.html',
|
||||||
|
'ha-chart-scripts.html',
|
||||||
];
|
];
|
||||||
|
|
||||||
// These panels will always be registered inside HA and thus can
|
// These panels will always be registered inside HA and thus can
|
||||||
|
@ -58,7 +58,6 @@ function getRollupInputOptions(es6) {
|
|||||||
__DEMO__: JSON.stringify(DEMO),
|
__DEMO__: JSON.stringify(DEMO),
|
||||||
__BUILD__: JSON.stringify(es6 ? 'latest' : 'es5'),
|
__BUILD__: JSON.stringify(es6 ? 'latest' : 'es5'),
|
||||||
__VERSION__: JSON.stringify(VERSION),
|
__VERSION__: JSON.stringify(VERSION),
|
||||||
__ROOT__: JSON.stringify(es6 ? 'frontend_latest' : 'frontend_es5'),
|
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
@ -96,6 +96,7 @@
|
|||||||
navigator.serviceWorker.register('/service_worker.js');
|
navigator.serviceWorker.register('/service_worker.js');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
window.CHART_SCRIPT = '/home-assistant-polymer/src/resources/ha-chart-scripts.html';
|
||||||
</script>
|
</script>
|
||||||
<!--<script src='/home-assistant-polymer/build/_demo_data_compiled.js'></script>-->
|
<!--<script src='/home-assistant-polymer/build/_demo_data_compiled.js'></script>-->
|
||||||
<!--EXTRA_SCRIPTS-->
|
<!--EXTRA_SCRIPTS-->
|
||||||
|
@ -5,7 +5,6 @@ window.HASS_DEMO = __DEMO__;
|
|||||||
window.HASS_DEV = __DEV__;
|
window.HASS_DEV = __DEV__;
|
||||||
window.HASS_BUILD = __BUILD__;
|
window.HASS_BUILD = __BUILD__;
|
||||||
window.HASS_VERSION = __VERSION__;
|
window.HASS_VERSION = __VERSION__;
|
||||||
window.HASS_ROOT = __ROOT__;
|
|
||||||
|
|
||||||
const init = window.createHassConnection = function (password) {
|
const init = window.createHassConnection = function (password) {
|
||||||
const proto = window.location.protocol === 'https:' ? 'wss' : 'ws';
|
const proto = window.location.protocol === 'https:' ? 'wss' : 'ws';
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<link rel='import' href='../../../bower_components/polymer/polymer-element.html'>
|
<link rel='import' href='../../../bower_components/polymer/polymer-element.html'>
|
||||||
<link rel='import' href='../../resources/ha-chart-scripts.html'>
|
|
||||||
|
|
||||||
<dom-module id="ha-chart-base">
|
<dom-module id="ha-chart-base">
|
||||||
<template>
|
<template>
|
||||||
@ -148,7 +147,7 @@
|
|||||||
|
|
||||||
if (!SCRIPT_LOADED) {
|
if (!SCRIPT_LOADED) {
|
||||||
Polymer.importHref(
|
Polymer.importHref(
|
||||||
`${window.HASS_ROOT}/ha-chart-scripts.html`,
|
window.CHART_SCRIPT,
|
||||||
() => {
|
() => {
|
||||||
SCRIPT_LOADED = true;
|
SCRIPT_LOADED = true;
|
||||||
this.onPropsChange();
|
this.onPropsChange();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user