mirror of
https://github.com/home-assistant/frontend.git
synced 2025-06-25 03:26:34 +00:00

* Build ES5/ES6 in parallel to share gulp deps * Rollup es5 files into build-temp-es5 * Use correct ES5 path for compatibility.js
46 lines
1.3 KiB
JavaScript
Executable File
46 lines
1.3 KiB
JavaScript
Executable File
const gulp = require('gulp');
|
|
const rename = require('gulp-rename');
|
|
|
|
const {
|
|
stripImportsStrategy,
|
|
} = require('../common/strategy');
|
|
const minifyStream = require('../common/transform').minifyStream;
|
|
const {
|
|
bundledStreamFromHTML,
|
|
findDependencies
|
|
} = require('../common/html');
|
|
|
|
const { polymer_dir } = require('../config');
|
|
|
|
const DEPS_TO_STRIP = [
|
|
'bower_components/font-roboto/roboto.html',
|
|
'bower_components/paper-styles/color.html',
|
|
'bower_components/iron-meta/iron-meta.html',
|
|
];
|
|
const DEPS_TO_STRIP_RECURSIVELY = [
|
|
'bower_components/polymer/polymer.html',
|
|
];
|
|
|
|
async function buildHassioPanel(es6) {
|
|
const toStrip = [...DEPS_TO_STRIP];
|
|
|
|
for (const dep of DEPS_TO_STRIP_RECURSIVELY) {
|
|
toStrip.push(dep);
|
|
const deps = await findDependencies(polymer_dir, dep);
|
|
for (const importUrl of deps) {
|
|
toStrip.push(importUrl);
|
|
}
|
|
}
|
|
|
|
const stream = await bundledStreamFromHTML('panels/hassio/hassio-main.html', {
|
|
strategy: stripImportsStrategy(toStrip)
|
|
});
|
|
|
|
return minifyStream(stream, es6)
|
|
.pipe(rename('hassio-main.html'))
|
|
.pipe(gulp.dest(es6 ? 'build-temp' : 'build-temp-es5'));
|
|
}
|
|
|
|
gulp.task('hassio-panel-es5', buildHassioPanel.bind(null, /* es6= */ false));
|
|
gulp.task('hassio-panel', buildHassioPanel.bind(null, /* es6= */ true));
|