Last active
June 15, 2016 07:41
-
-
Save lajlev/f5ee1e2e2e315f5274b10ec6d9ca93a0 to your computer and use it in GitHub Desktop.
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 | |
# Requires sketch and Sketchtool | |
# Q: How to enable it? | |
# A: Add it to your repo pre-commit hook | |
# Q: What does it do? | |
# A: It creates a .exportArtboards folder with all artboards as PNGs, | |
# so you easily can see changes in GIT 🎊. | |
git diff --cached --name-status | while read STATE FILE; do | |
# Skip deleted files | |
if [ "$STATE" == 'D' ]; then continue; fi | |
# Do a check only on the sketch files files | |
if [[ ${FILE: -7} == ".sketch" ]]; then | |
DIR=$(dirname "${FILE}") | |
sketchtool export artboards $FILE --output="${DIR}/.exportArtboards" --overwriting=YES --trimmed=NO --save-for-web=YES | |
git add ${DIR}/.exportArtboards | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment