Created
March 21, 2015 17:55
-
-
Save magadanskiuchen/3f12d5e7260777fe0087 to your computer and use it in GitHub Desktop.
A GIT post-merge hook to auto combine and minify all of your JavaScript files when merging a branch into "production"
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
current_branch="$(git rev-parse --abbrev-ref HEAD)"; | |
if [[ $current_branch == 'production' ]]; then | |
find js -name *.js | xargs cat > js/combined.js | |
curl -X POST -s --data-urlencode 'input@js/combined.js' http://javascript-minifier.com/raw > js/combined.min.js | |
rm js/combined.js | |
git commit -a -m "[automated] combined and minified JS" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment