From a977251953843d1b45863d68c69f3cc08af72f8a Mon Sep 17 00:00:00 2001 From: James Barnsley Date: Thu, 12 Jan 2017 20:19:41 +1300 Subject: [PATCH] Use cachebuster and default to minified code; test.html for debug version --- build.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 15cfb964..fb52a598 100755 --- a/build.sh +++ b/build.sh @@ -4,6 +4,15 @@ if [ ! -d public_html ]; then ln -s mopidy_iris/static public_html fi -cp src/index.html mopidy_iris/static/index.html +# copy assets cp src/.htaccess mopidy_iris/static/.htaccess -rsync -avr src/assets/ mopidy_iris/static/assets/ \ No newline at end of file +rsync -avr src/assets/ mopidy_iris/static/assets/ + +# create HTML files +cp src/index.html mopidy_iris/static/index.html +cp src/index.html mopidy_iris/static/test.html + +# process production html +CACHEBUSTER=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1) +sed -i 's/app.js/app.min.js?'$CACHEBUSTER'/g' mopidy_iris/static/index.html +sed -i 's/app.css/app.min.css?'$CACHEBUSTER'/g' mopidy_iris/static/index.html \ No newline at end of file