core/scripts/build_frontend

38 lines
1.2 KiB
Plaintext
Raw Normal View History

2015-02-09 07:33:19 +00:00
# Call 'build_frontend demo' to build a demo frontend.
2015-01-17 22:32:33 +00:00
# If current pwd is scripts, go 1 up.
if [ ${PWD##*/} == "scripts" ]; then
cd ..
fi
2015-02-09 07:33:19 +00:00
scripts/build_js $1
2015-02-06 06:36:23 +00:00
# To build the frontend, you need node, bower and vulcanize
# npm install -g bower vulcanize
2014-11-12 08:36:20 +00:00
# Install dependencies
cd homeassistant/components/frontend/www_static/polymer
2014-10-22 07:18:00 +00:00
bower install
2014-10-27 01:10:01 +00:00
cd ..
2014-11-12 08:36:20 +00:00
cp polymer/bower_components/webcomponentsjs/webcomponents.min.js .
# Let Polymer refer to the minified JS version before we compile
sed -i.bak 's/polymer\.js/polymer\.min\.js/' polymer/bower_components/polymer/polymer.html
vulcanize -o frontend.html --inline --strip polymer/home-assistant.html
2014-11-12 08:36:20 +00:00
# Revert back the change to the Polymer component
rm polymer/bower_components/polymer/polymer.html
mv polymer/bower_components/polymer/polymer.html.bak polymer/bower_components/polymer/polymer.html
# Generate the MD5 hash of the new frontend
2014-10-27 01:10:01 +00:00
cd ..
2015-01-30 16:26:06 +00:00
echo '""" DO NOT MODIFY. Auto-generated by build_frontend script """' > version.py
if [ $(command -v md5) ]; then
2015-01-30 16:26:06 +00:00
echo 'VERSION = "'`md5 -q www_static/frontend.html`'"' >> version.py
elif [ $(command -v md5sum) ]; then
2015-01-30 16:26:06 +00:00
echo 'VERSION = "'`md5sum www_static/frontend.html | cut -c-32`'"' >> version.py
else
echo 'Could not find a MD5 utility'
fi