Created
June 11, 2014 20:05
-
-
Save meza/a9b8a2a634e604e7bd40 to your computer and use it in GitHub Desktop.
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/sh | |
# | |
# Pre-commit hooks | |
compileResult=0 | |
# Compress stuff before committing | |
SRC_PATTERN="(\.css|\.scss|\.svg)" | |
git diff --cached --name-only | if egrep "$SRC_PATTERN" | |
then | |
echo "----> Found CSS changes, updating the compressed versions" | |
node_modules/.bin/grunt | |
compileResult=$? | |
git add assets/stylesheets/admin.css | |
git add assets/stylesheets/base.css | |
git add assets/assets.map | |
git add manifest.appcache | |
fi | |
# Exit code 1 means don't commit and 0 means do commit | |
[ $compileResult -ne 0 ] && exit 1 | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment