opt-cc/minify.sh

16 lines
463 B
Bash
Executable File

#!/usr/bin/env bash
# execute script in its location folder
cd $(dirname $0)
# array of files to minify
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)
OPTIONS="-c toplevel,dead_code=true,unused=true"
for i in "${FILES[@]}"
do
echo "minify ${i} ..."
$(npm bin)/uglifyjs public/${i}.js ${OPTIONS} -o public/${i}.js
rm -f public/${i}.js.map
done