1
mirror of https://github.com/home-assistant/frontend synced 2024-09-12 05:34:56 +02:00

Fingerprint charts (#883)

* Fingerprint charts URL

* cache in service worker
This commit is contained in:
Paulus Schoutsen 2018-02-11 09:01:17 -08:00 committed by GitHub
parent b6ad4edd32
commit 4c5d85746c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 5 additions and 5 deletions

View File

@ -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')
]);

View File

@ -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) {

View File

@ -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

View File

@ -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'),
},
}),
],

View File

@ -96,6 +96,7 @@
navigator.serviceWorker.register('/service_worker.js');
});
}
window.CHART_SCRIPT = '/home-assistant-polymer/src/resources/ha-chart-scripts.html';
</script>
<!--<script src='/home-assistant-polymer/build/_demo_data_compiled.js'></script>-->
<!--EXTRA_SCRIPTS-->

View File

@ -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';

View File

@ -1,5 +1,4 @@
<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">
<template>
@ -148,7 +147,7 @@
if (!SCRIPT_LOADED) {
Polymer.importHref(
`${window.HASS_ROOT}/ha-chart-scripts.html`,
window.CHART_SCRIPT,
() => {
SCRIPT_LOADED = true;
this.onPropsChange();