Created
March 28, 2010 01:43
-
-
Save dgageot/346489 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 hook that crushes PNG files in order to reduce their size. | |
if ! which -s pngcrush | |
then | |
echo "Please install pngcrush to reduce png images size before commit" | |
exit 1; | |
fi | |
for file in `git diff --cached --name-only | grep ".png\$"` | |
do | |
echo "Crushing $file" | |
pngcrush -rem allb -brute -reduce $file ${file%.png}.new | grep "filesize" | |
mv -f ${file%.png}.new $file | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment