Created
July 2, 2013 08:14
-
-
Save silvers/5907571 to your computer and use it in GitHub Desktop.
if git-add *.scss, then compile.
This file contains hidden or 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/sh | |
NAME=$(git branch | grep '*' | sed 's/* //') | |
# don't run on rebase | |
if [ $NAME != '(no branch)' ]; then | |
EDITSCSS=$(git --no-pager diff --diff-filter=AM --name-only --no-color --cached | grep 'scss' | wc -l) | |
if [ $EDITSCSS -ne 0 ]; then | |
git stash -q --keep-index | |
# compile css | |
grunt css | |
RETVAL=$? | |
if [ $RETVAL -ne 0 ]; then | |
git stash pop -q | |
exit 1 | |
fi | |
git add . | |
git stash pop -q | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment