-
-
Save ghuntley/1048696 to your computer and use it in GitHub Desktop.
git post-checkout hook for compressing javascript (via uglifyjs)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
branch=$(git symbolic-ref -q HEAD |sed 's/refs\/heads\///') | |
gitroot=$(git rev-parse --show-toplevel) | |
jsdir="js" | |
targetdir="$gitroot/$jsdir" | |
files=$(find $targetdir -maxdepth 1 -type f -name '*.js' ! \( -name '*.min.js' \)) | |
echo -n "Uglifying javascript... " | |
for f in $files; do | |
uglifyjs $f > $(echo $f |sed 's/\(\.js\)$/\.min\1/') | |
done | |
echo "done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment