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:
version: 5.10.1
environment:
BUILD_PRODUCTION: true
NODE_ENV: production
dependencies:
pre:

View file

@ -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

View file

@ -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

View file

@ -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