From 701ca67b5a4a753c4508bd0cf9ee2746e442084b Mon Sep 17 00:00:00 2001 From: James Barnsley Date: Fri, 13 Jan 2017 08:23:07 +1300 Subject: [PATCH] Fixing issues where cachebuster wasn't working --- build.sh | 12 +++++++++--- package.json | 6 +++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/build.sh b/build.sh index fb52a598..aced77c7 100755 --- a/build.sh +++ b/build.sh @@ -1,18 +1,24 @@ #!/bin/bash if [ ! -d public_html ]; then + echo -e Creating mopidy_iris/static folder ln -s mopidy_iris/static public_html fi # copy assets +echo -e Copying assets $SERVER cp src/.htaccess mopidy_iris/static/.htaccess -rsync -avr src/assets/ mopidy_iris/static/assets/ +rsync -avrs src/assets/ mopidy_iris/static/assets/ 2>&1 >/dev/null # create HTML files +echo -e Copying index.html and test.html 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) +CACHEBUSTER=$(date | md5sum | cut -f1 -d' ') +echo -e Cachebusting js/css URLs $CACHEBUSTER 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 +sed -i 's/app.css/app.min.css?'$CACHEBUSTER'/g' mopidy_iris/static/index.html + +echo -e "\x1b[32;01m"Done!"\x1b[39;49;00m" \ No newline at end of file diff --git a/package.json b/package.json index dd58d52b..7e2a18fd 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mopidy-iris", - "version": "2.10.12", + "version": "2.10.17", "description": "Mopidy HTTP interface", "repository": "https://github.com/jaedb/iris", "author": "James Barnsley ", @@ -41,7 +41,7 @@ "react-ga": "2.1.2" }, "scripts": { - "dev": "./build.sh & NODE_ENV=development webpack", - "prod": "./build.sh & NODE_ENV=production webpack" + "dev": "NODE_ENV=development webpack && ./build.sh", + "prod": "NODE_ENV=production webpack && ./build.sh" } }