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

47 lines
1.8 KiB
Bash
Raw 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-14 19:13:08 +00:00
if [[ $@ == prod ]]
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-14 19:13:08 +00:00
if [[ $@ == prod ]]
2016-01-14 19:08:12 +00:00
then
echo ">> Compressing Libraries..."
uglifyjs node_modules/markdown/lib/markdown.js --compress --screw-ie8 --define --stats --keep-fnames -o static/build/js/lib/markdown.js
uglifyjs node_modules/bootstrap/dist/js/bootstrap.js --compress --screw-ie8 --define --stats --keep-fnames -o static/build/js/lib/bootstrap.js
2016-01-18 22:47:00 +00:00
uglifyjs node_modules/bootstrap-material-design/dist/js/material.min.js --compress --screw-ie8 --define --stats --keep-fnames -o static/build/js/lib/bootstrap-material.js
2016-01-14 19:08:12 +00:00
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/markdown/lib/markdown.js static/build/js/lib/markdown.js
cp node_modules/bootstrap/dist/js/bootstrap.js static/build/js/lib/bootstrap.js
2016-01-18 22:47:00 +00:00
cp node_modules/bootstrap-material-design/dist/js/material.min.js static/build/js/lib/bootstrap-material.js
2016-01-14 19:08:12 +00:00
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-14 19:13:08 +00:00
if [[ $@ == prod ]]
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..."
cp node_modules/jquery/dist/jquery.js static/build/js/jquery.js
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-14 19:13:08 +00:00
if [[ $@ == prod ]]
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