hass-core/script/build_frontend
Paulus Schoutsen d4dfb4d80c Polymer 2 (#8815)
* Update build for Polymer 2

* Update webcomponents polyfills/helpers

* Load ES5 class adapter when not in dev mode

* Update frontend
2017-08-03 23:46:57 -07:00

34 lines
1.1 KiB
Bash
Executable file

#!/bin/sh
# Builds the frontend for production
# Stop on errors
set -e
cd "$(dirname "$0")/.."
# Clean up
rm -rf homeassistant/components/frontend/www_static/core.js* \
homeassistant/components/frontend/www_static/compatibility.js* \
homeassistant/components/frontend/www_static/frontend.html* \
homeassistant/components/frontend/www_static/webcomponents-lite.js* \
homeassistant/components/frontend/www_static/custom-elements-es5-adapter.js* \
homeassistant/components/frontend/www_static/panels
cd homeassistant/components/frontend/www_static/home-assistant-polymer
# Build frontend
BUILD_DEV=0 gulp
cp bower_components/webcomponentsjs/webcomponents-lite.js ..
cp bower_components/webcomponentsjs/custom-elements-es5-adapter.js ..
cp build/*.js build/*.html ..
mkdir ../panels
cp build/panels/*.html ../panels
BUILD_DEV=0 gulp gen-service-worker
cp build/service_worker.js ..
cd ..
# Pack frontend
gzip -f -n -k -9 *.html *.js ./panels/*.html
cd ../../../..
# Generate the MD5 hash of the new frontend
script/fingerprint_frontend.py