Created
May 22, 2018 14:11
-
-
Save victoriadrake/c54993193f5462f5af1cb17e22fd2233 to your computer and use it in GitHub Desktop.
A pre-commit hook that optimizes images in-place in the current directory.
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 | |
# in git repo: cp pre-commit-imgopt .git/hooks | |
# add execute permissions: chmod +x .git/hooks/pre-commit-imgopt | |
find . -name '*.png' -print0 | xargs -0 -P8 -n2 optipng -o5 | |
find . -name '*.jpg' -print0 | xargs -0 -P8 -n2 jpegoptim --strip-all -m30 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment