2015-02-22 17:33:01 -08:00
|
|
|
# Builds the frontend for production
|
2015-02-08 23:33:19 -08:00
|
|
|
# Call 'build_frontend demo' to build a demo frontend.
|
|
|
|
|
2015-01-17 14:32:33 -08:00
|
|
|
# If current pwd is scripts, go 1 up.
|
|
|
|
if [ ${PWD##*/} == "scripts" ]; then
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
2015-02-08 23:33:19 -08:00
|
|
|
scripts/build_js $1
|
2015-02-05 22:36:23 -08:00
|
|
|
|
2014-10-24 22:59:36 -07:00
|
|
|
# To build the frontend, you need node, bower and vulcanize
|
|
|
|
# npm install -g bower vulcanize
|
2014-11-12 00:36:20 -08:00
|
|
|
|
|
|
|
# Install dependencies
|
2015-01-29 23:56:04 -08:00
|
|
|
cd homeassistant/components/frontend/www_static/polymer
|
2014-10-22 00:18:00 -07:00
|
|
|
bower install
|
2014-10-26 18:10:01 -07:00
|
|
|
cd ..
|
2015-05-28 01:08:50 -07:00
|
|
|
cp polymer/bower_components/webcomponentsjs/webcomponents-lite.min.js .
|
2014-11-12 00:36:20 -08:00
|
|
|
|
2015-05-28 01:08:50 -07:00
|
|
|
# Prevent vulcanize choking on a url starting with //
|
|
|
|
sed -i.bak 's/"\/\/fonts/"https:\/\/fonts/' polymer/bower_components/paper-styles/typography.html
|
2014-11-13 22:47:06 -08:00
|
|
|
|
2015-05-28 01:08:50 -07:00
|
|
|
vulcanize --inline-css --inline-scripts --strip-comments polymer/home-assistant.html > frontend.html
|
2014-11-12 00:36:20 -08:00
|
|
|
|
2015-05-28 01:08:50 -07:00
|
|
|
# Revert back the change to the paper-styles component
|
|
|
|
rm polymer/bower_components/paper-styles/typography.html
|
|
|
|
mv polymer/bower_components/paper-styles/typography.html.bak polymer/bower_components/paper-styles/typography.html
|
2014-11-12 00:36:20 -08:00
|
|
|
|
|
|
|
# Generate the MD5 hash of the new frontend
|
2014-10-26 18:10:01 -07:00
|
|
|
cd ..
|
2015-01-30 08:26:06 -08:00
|
|
|
echo '""" DO NOT MODIFY. Auto-generated by build_frontend script """' > version.py
|
2015-01-22 05:22:40 +00:00
|
|
|
if [ $(command -v md5) ]; then
|
2015-01-30 08:26:06 -08:00
|
|
|
echo 'VERSION = "'`md5 -q www_static/frontend.html`'"' >> version.py
|
2015-01-22 05:22:40 +00:00
|
|
|
elif [ $(command -v md5sum) ]; then
|
2015-01-30 08:26:06 -08:00
|
|
|
echo 'VERSION = "'`md5sum www_static/frontend.html | cut -c-32`'"' >> version.py
|
2015-01-22 05:22:40 +00:00
|
|
|
else
|
2015-04-14 23:55:08 -04:00
|
|
|
echo 'Could not find an MD5 utility'
|
2015-01-22 05:22:40 +00:00
|
|
|
fi
|