Fix hass.io panel (#1148)

This commit is contained in:
Paulus Schoutsen 2018-05-08 11:54:38 -04:00 committed by Pascal Vizeli
parent 3da55c6ab5
commit eeba117e4b
2 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,7 @@
const del = require('del'); const del = require('del');
const gulp = require('gulp'); const gulp = require('gulp');
const rename = require('gulp-rename'); const rename = require('gulp-rename');
const replace = require('gulp-batch-replace');
const gzip = require('gulp-gzip'); const gzip = require('gulp-gzip');
const path = require('path'); const path = require('path');
const runSequence = require('run-sequence'); const runSequence = require('run-sequence');
@ -20,6 +21,8 @@ const DEPS_TO_STRIP = [
'bower_components/paper-styles/color.html', 'bower_components/paper-styles/color.html',
]; ];
const es5Extra = "<script src='/frontend_es5/custom-elements-es5-adapter.js'></script>";
async function buildHassioPanel() { async function buildHassioPanel() {
const stream = await bundledStreamFromHTML('hassio/hassio-app.html', { const stream = await bundledStreamFromHTML('hassio/hassio-app.html', {
strategy: stripImportsStrategy(DEPS_TO_STRIP) strategy: stripImportsStrategy(DEPS_TO_STRIP)
@ -32,6 +35,7 @@ async function buildHassioPanel() {
function copyHassioIndex() { function copyHassioIndex() {
return gulp.src('hassio/index.html') return gulp.src('hassio/index.html')
.pipe(replace([['<!--EXTRA_SCRIPTS-->', es5Extra]]))
.pipe(gulp.dest(OUTPUT_DIR)); .pipe(gulp.dest(OUTPUT_DIR));
} }

View File

@ -11,6 +11,7 @@
padding: 0; padding: 0;
} }
</style> </style>
<!--EXTRA_SCRIPTS-->
</head> </head>
<body> <body>
<hassio-app></hassio-app> <hassio-app></hassio-app>
@ -20,9 +21,6 @@
e.src = src; e.src = src;
document.head.appendChild(e); document.head.appendChild(e);
} }
if (!window.parent.HASS_DEV) {
addScript('/frontend_es5/custom-elements-es5-adapter.js');
}
var webComponentsSupported = ( var webComponentsSupported = (
'customElements' in window && 'customElements' in window &&
'import' in document.createElement('link') && 'import' in document.createElement('link') &&