Skip to content

Instantly share code, notes, and snippets.

@drichert
drichert / post-checkout
Created April 27, 2011 21:18
git post-checkout hook for compressing javascript (via uglifyjs)
#!/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