Skip to content

Instantly share code, notes, and snippets.

@gboone
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gboone/d1aaa83c68648bef4783 to your computer and use it in GitHub Desktop.
Save gboone/d1aaa83c68648bef4783 to your computer and use it in GitHub Desktop.
A commit hook to run imageoptim on all images in your assets/ directory
#!/bin/sh
#
# A pre-commit hook that runs Image Optim against all images in the /assets
# directory. Requires you have Image Optim installed and will fail silently if
# you don't have it installed to /Applications/. Image optim will skip any
# images already optimized but this may take time, especially if you've never
# run it before or have many images. Rename this pre-commit and move to your
# project's .git/hooks/ directory
#
# /Applications/ImageOptim.app/Contents/MacOS/ImageOptim *.png
#
# bypass with --no-verify
#
if test -e /Applications/ImageOptim.app/Contents/MacOS/ImageOptim
then
/Applications/ImageOptim.app/Contents/MacOS/ImageOptim assets/
else
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment