Skip to content

Instantly share code, notes, and snippets.

@andreasvirkus
Last active May 22, 2017 21:56
Show Gist options
  • Save andreasvirkus/bf35b5dd2e34a2b3bf3f3b2380f1876a to your computer and use it in GitHub Desktop.
Save andreasvirkus/bf35b5dd2e34a2b3bf3f3b2380f1876a to your computer and use it in GitHub Desktop.
#!/bin/bash
# Loop through all script files and minify them individually
# to leverage that sweet HTTP/2 performance
#
# Alternative is to minify them into one file:
# uglifyjs ./dist/assets/js/*.js -c -m -o ./dist/assets/js/script.min.js
FILES=./dist/assets/js/*
for f in $FILES
do
node_modules/.bin/uglifyjs $f -c -m --overwrite -o ./dist/assets/js/$(basename $f .js).min.js
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment