Skip to content

Instantly share code, notes, and snippets.

@gheydon
Created August 7, 2013 06:57
Show Gist options
  • Save gheydon/6171813 to your computer and use it in GitHub Desktop.
Save gheydon/6171813 to your computer and use it in GitHub Desktop.
#!/bin/sh
themes_altered=()
for config in docroot/sites/*/themes/*/config.rb
do
theme_dir=`dirname $config`
git diff --cached --exit-code $theme_dir/sass/*.scss > /dev/null
if [ "$?" -eq 1 ]; then
themes_altered+=($theme_dir)
# the css is going to be blown away anyway so lets revert it to HEAD
git checkout HEAD -- $theme_dir/css
fi
done
if [ "${#themes_altered[@]}" -gt "0" ]; then
git stash save --keep-index "Compass recompile"
for dir in "${themes_altered[@]}"
do
/usr/bin/compass compile $dir -e production --boring --force
git add $dir/css/*.css $dir/css/*/*.css
done
git stash pop
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment