1
Fork 0
This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
theorangeone.net-legacy/scripts/build-js.sh

45 lines
1.4 KiB
Bash
Raw Permalink Normal View History

2015-12-11 08:27:29 +00:00
#!/usr/bin/env bash
2015-10-19 13:04:49 +01:00
set -e
2016-01-30 00:11:31 +00:00
if [[ $BUILD_PRODUCTION ]]
2016-01-14 19:08:12 +00:00
then
echo ">>> WARNING: Building in Production Mode!"
fi
mkdir -p static/build/js/lib
2016-01-14 19:08:12 +00:00
2016-01-30 00:11:31 +00:00
if [[ $BUILD_PRODUCTION ]]
2016-01-14 19:08:12 +00:00
then
echo ">> Compressing Libraries..."
uglifyjs node_modules/bootstrap/dist/js/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
else
echo ">> Building Libraries..."
cp node_modules/bootstrap/dist/js/bootstrap.js static/build/js/lib/bootstrap.js
uglifyjs static/build/js/lib/* --screw-ie8 --stats --keep-fnames -o static/build/js/libs.js
fi
2015-11-21 15:08:33 +00:00
rm -rf static/build/js/lib
2016-01-30 00:11:31 +00:00
if [[ $BUILD_PRODUCTION ]]
2016-01-14 19:08:12 +00:00
then
echo ">> Compressing jQuery..."
uglifyjs node_modules/jquery/dist/jquery.js --compress --screw-ie8 --define --stats --keep-fnames -o static/build/js/jquery.js
else
echo ">> Building jQuery..."
2016-01-18 22:47:14 +00:00
uglifyjs node_modules/jquery/dist/jquery.js --screw-ie8 --stats --keep-fnames -o 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..."
2015-11-23 14:21:04 +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-01-30 00:11:31 +00:00
if [[ $BUILD_PRODUCTION ]]
2016-01-14 19:08:12 +00:00
then
echo ">> Compressing Application..."
uglifyjs static/build/js/app.js --compress --screw-ie8 --define --stats --keep-fnames -o static/build/js/app.js
fi
2016-02-28 22:22:19 +00:00
echo "> JS Built!"