opt-cc/minify.sh

16 lines
463 B
Bash
Raw Normal View History

2017-07-29 11:46:01 +02:00
#!/usr/bin/env bash
2017-08-05 23:19:23 +02:00
# execute script in its location folder
cd $(dirname $0)
2017-07-29 11:46:01 +02:00
# array of files to minify
2017-09-03 12:49:59 +02:00
FILES=(inline.bundle main.bundle polyfills.bundle scripts.bundle styles.bundle vendor.bundle 0.chunk 1.chunk 2.chunk 3.chunk 4.chunk 5.chunk 6.chunk 7.chunk)
2017-07-29 11:46:01 +02:00
OPTIONS="-c toplevel,dead_code=true,unused=true"
for i in "${FILES[@]}"
do
echo "minify ${i} ..."
2017-09-03 12:49:59 +02:00
$(npm bin)/uglifyjs public/${i}.js ${OPTIONS} -o public/${i}.js
rm -f public/${i}.js.map
2017-07-29 11:46:01 +02:00
done