35 lines
1.1 KiB
Plaintext
Executable File
35 lines
1.1 KiB
Plaintext
Executable File
# Builds the frontend for production
|
|
# Call 'build_frontend demo' to build a demo frontend.
|
|
|
|
# If current pwd is scripts, go 1 up.
|
|
if [ ${PWD##*/} == "scripts" ]; then
|
|
cd ..
|
|
fi
|
|
|
|
scripts/build_js $1
|
|
|
|
# To build the frontend, you need node, bower, vulcanize and html-minifier
|
|
# npm install -g bower vulcanize html-minifier
|
|
|
|
# Install dependencies
|
|
cd homeassistant/components/frontend/www_static/polymer
|
|
bower install
|
|
cd ..
|
|
cp polymer/bower_components/webcomponentsjs/webcomponents-lite.min.js .
|
|
|
|
vulcanize --inline-css --inline-scripts --strip-comments polymer/home-assistant.html > frontend.html
|
|
|
|
# html-minifier crashes on frontend, minimize kills the CSS
|
|
# html-minifier --config-file polymer/html-minifier.conf -o frontend.html frontend.html
|
|
|
|
# Generate the MD5 hash of the new frontend
|
|
cd ..
|
|
echo '""" DO NOT MODIFY. Auto-generated by build_frontend script """' > version.py
|
|
if [ $(command -v md5) ]; then
|
|
echo 'VERSION = "'`md5 -q www_static/frontend.html`'"' >> version.py
|
|
elif [ $(command -v md5sum) ]; then
|
|
echo 'VERSION = "'`md5sum www_static/frontend.html | cut -c-32`'"' >> version.py
|
|
else
|
|
echo 'Could not find an MD5 utility'
|
|
fi
|