2015-12-11 08:27:29 +00:00
|
|
|
#!/usr/bin/env bash
|
2015-10-19 13:04:49 +01:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2016-05-17 18:12:47 +01:00
|
|
|
if [ "$NODE_ENV" = "production" ]
|
2016-01-14 19:08:12 +00:00
|
|
|
then
|
|
|
|
echo ">>> WARNING: Building in Production Mode!"
|
|
|
|
fi
|
|
|
|
|
2016-11-24 15:07:22 +00:00
|
|
|
mkdir -p static/build/js/lib
|
2016-01-14 19:08:12 +00:00
|
|
|
|
2016-05-17 18:12:47 +01:00
|
|
|
if [ "$NODE_ENV" = "production" ]
|
2016-01-14 19:08:12 +00:00
|
|
|
then
|
|
|
|
echo ">> Compressing Libraries..."
|
2016-11-24 15:07:22 +00:00
|
|
|
uglifyjs node_modules/bootstrap-sass/assets/javascripts/bootstrap.js --compress --screw-ie8 --define --stats --keep-fnames -o static/build/js/lib/bootstrap.js
|
|
|
|
uglifyjs static/build/js/lib/* --compress --screw-ie8 --define --stats --keep-fnames -o static/build/js/libs.js
|
2016-01-14 19:08:12 +00:00
|
|
|
else
|
|
|
|
echo ">> Building Libraries..."
|
2016-11-24 15:07:22 +00:00
|
|
|
cp node_modules/bootstrap-sass/assets/javascripts/bootstrap.js static/build/js/lib/bootstrap.js
|
|
|
|
uglifyjs static/build/js/lib/* --screw-ie8 --stats --keep-fnames -o static/build/js/libs.js
|
2016-01-14 19:08:12 +00:00
|
|
|
fi
|
|
|
|
|
2016-11-24 15:07:22 +00:00
|
|
|
rm -rf static/build/js/lib
|
2015-11-21 15:08:33 +00:00
|
|
|
|
2016-05-17 18:12:47 +01:00
|
|
|
if [ "$NODE_ENV" = "production" ]
|
2016-01-14 19:08:12 +00:00
|
|
|
then
|
|
|
|
echo ">> Compressing jQuery..."
|
2016-11-24 15:07:22 +00:00
|
|
|
uglifyjs node_modules/jquery/dist/jquery.js --compress --screw-ie8 --define --stats --keep-fnames -o static/build/js/jquery.js
|
2016-01-14 19:08:12 +00:00
|
|
|
else
|
|
|
|
echo ">> Building jQuery..."
|
2016-11-24 15:07:22 +00:00
|
|
|
cp node_modules/jquery/dist/jquery.js static/build/js/jquery.js
|
2016-01-14 19:08:12 +00:00
|
|
|
fi
|
|
|
|
|
2015-10-19 13:04:49 +01:00
|
|
|
|
|
|
|
echo ">> Building Application JS..."
|
2016-11-24 15:07:22 +00:00
|
|
|
browserify -t [ babelify --presets [ es2015 react ] ] static/src/js/app.js -o static/build/js/app.js
|
2016-01-14 19:08:12 +00:00
|
|
|
|
2016-05-17 18:12:47 +01:00
|
|
|
if [ "$NODE_ENV" = "production" ]
|
2016-01-14 19:08:12 +00:00
|
|
|
then
|
|
|
|
echo ">> Compressing Application..."
|
2016-11-24 15:07:22 +00:00
|
|
|
uglifyjs static/build/js/app.js --compress --screw-ie8 --define --stats --keep-fnames -o static/build/js/app.js
|
2016-01-14 19:08:12 +00:00
|
|
|
fi
|
2016-02-28 22:22:19 +00:00
|
|
|
|
|
|
|
echo "> JS Built!"
|