1
Fork 0

Replace custom variable with node env

This commit is contained in:
Jake Howard 2016-05-17 18:12:47 +01:00
parent ba91fdbb87
commit 965194c162
4 changed files with 9 additions and 9 deletions

View file

@ -4,7 +4,7 @@ machine:
node: node:
version: 5.10.1 version: 5.10.1
environment: environment:
BUILD_PRODUCTION: true NODE_ENV: production
dependencies: dependencies:
pre: pre:

View file

@ -2,14 +2,14 @@
set -e set -e
if [[ $BUILD_PRODUCTION ]] if [ "$NODE_ENV" = "production" ]
then then
echo ">>> WARNING: Building in Production Mode!" echo ">>> WARNING: Building in Production Mode!"
fi fi
mkdir -p theme/static/build/js/lib mkdir -p theme/static/build/js/lib
if [[ $BUILD_PRODUCTION ]] if [ "$NODE_ENV" = "production" ]
then then
echo ">> Compressing Libraries..." 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 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 rm -rf theme/static/build/js/lib
if [[ $BUILD_PRODUCTION ]] if [ "$NODE_ENV" = "production" ]
then then
echo ">> Compressing jQuery..." echo ">> Compressing jQuery..."
uglifyjs node_modules/jquery/dist/jquery.js --compress --screw-ie8 --define --stats --keep-fnames -o theme/static/build/js/jquery.js uglifyjs node_modules/jquery/dist/jquery.js --compress --screw-ie8 --define --stats --keep-fnames -o theme/static/build/js/jquery.js
else else
echo ">> Building jQuery..." 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 fi
echo ">> Building Application JS..." echo ">> Building Application JS..."
browserify -t [ babelify --presets [ es2015 react ] ] theme/static/src/js/app.js -o theme/static/build/js/app.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 then
echo ">> Compressing Application..." echo ">> Compressing Application..."
uglifyjs theme/static/build/js/app.js --compress --screw-ie8 --define --stats --keep-fnames -o theme/static/build/js/app.js uglifyjs theme/static/build/js/app.js --compress --screw-ie8 --define --stats --keep-fnames -o theme/static/build/js/app.js

View file

@ -2,7 +2,7 @@
set -e set -e
if [[ $BUILD_PRODUCTION ]] if [ "$NODE_ENV" = "production" ]
then then
echo ">>> WARNING: Building in Production Mode!" echo ">>> WARNING: Building in Production Mode!"
fi fi
@ -13,7 +13,7 @@ node-sass theme/static/src/scss/index.scss theme/static/build/css/index.css --so
echo ">> Post-Processing..." echo ">> Post-Processing..."
postcss -u autoprefixer -o theme/static/build/css/index.css theme/static/build/css/index.css postcss -u autoprefixer -o theme/static/build/css/index.css theme/static/build/css/index.css
if [[ $BUILD_PRODUCTION ]] if [ "$NODE_ENV" = "production" ]
then then
echo ">> Compressing CSS..." echo ">> Compressing CSS..."
cleancss -d --s0 -o theme/static/build/css/index.css theme/static/build/css/index.css cleancss -d --s0 -o theme/static/build/css/index.css theme/static/build/css/index.css

View file

@ -6,7 +6,7 @@ echo "> Creating Site..."
# Build the static data # Build the static data
echo ">> Building static data..." echo ">> Building static data..."
npm run build $@ npm run build
echo ">> Compiling site pages..." echo ">> Compiling site pages..."
pelican -v pelican -v