opt-cc/minify.sh

16 lines
553 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 admin.module.chunk common.chunk decoration.module.chunk ranks.module.chunk request.module.chunk squads.module.chunk stats.module.chunk users.module.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