1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-24 20:55:49 +00:00

Defer loading of dev tools

This commit is contained in:
Paulus Schoutsen
2016-07-12 08:59:07 -07:00
parent 78c8e680b2
commit e7ee8c54bd
24 changed files with 484 additions and 474 deletions

View File

@@ -21,7 +21,8 @@ function md5(filename) {
var appPaths = ['/', '/states', '/logbook', '/history', '/map',
'/devService', '/devState', '/devEvent', '/devInfo', '/devTemplate'];
var fingerprinted = ['frontend.html', 'mdi.html', 'core.js', 'partial-map.html'];
var fingerprinted = ['frontend.html', 'mdi.html', 'core.js', 'partial-map.html',
'dev-tools.html'];
var dynamicUrlToDependencies = {};

View File

@@ -16,24 +16,27 @@ function minifyHTML(html) {
});
}
var toProcess = [
const baseVulcanOptions = {
inlineScripts: true,
inlineCss: true,
implicitStrip: true,
stripComments: true,
};
const toProcess = [
{
source: 'src/home-assistant.html',
output: 'frontend.html',
vulcan: new Vulcanize({
vulcan: new Vulcanize(Object.assign({}, baseVulcanOptions, {
stripExcludes: [
'bower_components/font-roboto/roboto.html',
],
inlineScripts: true,
inlineCss: true,
implicitStrip: true,
stripComments: true,
}),
})),
},
{
source: 'src/layouts/partial-map.html',
output: 'partial-map.html',
vulcan: new Vulcanize({
vulcan: new Vulcanize(Object.assign({}, baseVulcanOptions, {
stripExcludes: [
'bower_components/polymer/polymer.html',
'bower_components/paper-toolbar/paper-toolbar.html',
@@ -41,16 +44,28 @@ var toProcess = [
'bower_components/iron-icon/iron-icon.html',
'bower_components/iron-image/iron-image.html',
],
inlineScripts: true,
inlineCss: true,
implicitStrip: true,
stripComments: true,
}),
})),
},
{
source: 'src/entry-points/dev-tools.html',
output: 'dev-tools.html',
vulcan: new Vulcanize(Object.assign({}, baseVulcanOptions, {
stripExcludes: [
'bower_components/polymer/polymer.html',
'bower_components/paper-button/paper-button.html',
'bower_components/paper-input/paper-input.html',
'bower_components/paper-icon-button/paper-icon-button.html',
'bower_components/paper-spinner/paper-spinner.html',
'bower_components/paper-toolbar/paper-toolbar.html',
'bower_components/paper-menu/paper-menu.html',
'bower_components/paper-scroll-header-panel/paper-scroll-header-panel.html',
],
})),
},
];
toProcess.forEach(function (info) {
info.vulcan.process(info.source, function (err, inlinedHtml) {
toProcess.forEach(info => {
info.vulcan.process(info.source, (err, inlinedHtml) => {
if (err !== null) {
console.error(info.source, err);
return;