From 965194c162334f8778c2550e2873c84be57d4f91 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Tue, 17 May 2016 18:12:47 +0100 Subject: [PATCH] Replace custom variable with node env --- circle.yml | 2 +- scripts/build-js.sh | 10 +++++----- scripts/build-scss.sh | 4 ++-- scripts/generate-site.sh | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/circle.yml b/circle.yml index a2b85e3..d1bc6d4 100644 --- a/circle.yml +++ b/circle.yml @@ -4,7 +4,7 @@ machine: node: version: 5.10.1 environment: - BUILD_PRODUCTION: true + NODE_ENV: production dependencies: pre: diff --git a/scripts/build-js.sh b/scripts/build-js.sh index c76274f..2071800 100755 --- a/scripts/build-js.sh +++ b/scripts/build-js.sh @@ -2,14 +2,14 @@ set -e -if [[ $BUILD_PRODUCTION ]] +if [ "$NODE_ENV" = "production" ] then echo ">>> WARNING: Building in Production Mode!" fi mkdir -p theme/static/build/js/lib -if [[ $BUILD_PRODUCTION ]] +if [ "$NODE_ENV" = "production" ] then echo ">> Compressing Libraries..." uglifyjs node_modules/bootstrap-sass/assets/javascripts/bootstrap.js --compress --screw-ie8 --define --stats --keep-fnames -o theme/static/build/js/lib/bootstrap.js @@ -22,20 +22,20 @@ fi rm -rf theme/static/build/js/lib -if [[ $BUILD_PRODUCTION ]] +if [ "$NODE_ENV" = "production" ] then echo ">> Compressing jQuery..." uglifyjs node_modules/jquery/dist/jquery.js --compress --screw-ie8 --define --stats --keep-fnames -o theme/static/build/js/jquery.js else echo ">> Building jQuery..." - uglifyjs node_modules/jquery/dist/jquery.js --screw-ie8 --stats --keep-fnames -o theme/static/build/js/jquery.js + cp node_modules/jquery/dist/jquery.js theme/static/build/js/jquery.js fi echo ">> Building Application JS..." browserify -t [ babelify --presets [ es2015 react ] ] theme/static/src/js/app.js -o theme/static/build/js/app.js -if [[ $BUILD_PRODUCTION ]] +if [ "$NODE_ENV" = "production" ] then echo ">> Compressing Application..." uglifyjs theme/static/build/js/app.js --compress --screw-ie8 --define --stats --keep-fnames -o theme/static/build/js/app.js diff --git a/scripts/build-scss.sh b/scripts/build-scss.sh index 1d867b2..8dea557 100644 --- a/scripts/build-scss.sh +++ b/scripts/build-scss.sh @@ -2,7 +2,7 @@ set -e -if [[ $BUILD_PRODUCTION ]] +if [ "$NODE_ENV" = "production" ] then echo ">>> WARNING: Building in Production Mode!" fi @@ -13,7 +13,7 @@ node-sass theme/static/src/scss/index.scss theme/static/build/css/index.css --so echo ">> Post-Processing..." postcss -u autoprefixer -o theme/static/build/css/index.css theme/static/build/css/index.css -if [[ $BUILD_PRODUCTION ]] +if [ "$NODE_ENV" = "production" ] then echo ">> Compressing CSS..." cleancss -d --s0 -o theme/static/build/css/index.css theme/static/build/css/index.css diff --git a/scripts/generate-site.sh b/scripts/generate-site.sh index 40b8614..5a9f6ad 100644 --- a/scripts/generate-site.sh +++ b/scripts/generate-site.sh @@ -6,7 +6,7 @@ echo "> Creating Site..." # Build the static data echo ">> Building static data..." -npm run build $@ +npm run build echo ">> Compiling site pages..." pelican -v