opt-cc/minify.sh

16 lines
378 B
Bash
Executable File

#!/usr/bin/env bash
# execute script in its location folder
cd $(dirname $0)
# array of files to minify
FILES=(inline main polyfills scripts styles vendor)
OPTIONS="-c toplevel,dead_code=true,unused=true"
for i in "${FILES[@]}"
do
echo "minify ${i} ..."
$(npm bin)/uglifyjs public/${i}.bundle.js ${OPTIONS} -o public/${i}.bundle.js
rm -f public/${i}.bundle.js.map
done