Skip to content

Instantly share code, notes, and snippets.

@DArcMattr
Created September 3, 2013 19:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DArcMattr/6428630 to your computer and use it in GitHub Desktop.
Save DArcMattr/6428630 to your computer and use it in GitHub Desktop.
Assumptions: You are using the SCSS flavor of SASS; even if you don't have SASS installed on the system you're using this on, you have it and compass installed on a machine you have SSH access to. Installation: 1) you *must* create a symbolic link to this in your .git/hooks directory "ln -s /path/to/git/hook/in/source/control /path/to/.git/hooks…
#!/bin/sh
# Create a symbolic link to this in the .git/hooks directory
theme_path="/absolute/path/to/theme/directory/here"
if [ $(git diff HEAD@{1} HEAD --name-only | grep -E 'style.scss' -c) -ne 0 ]; then
echo "style.scss changed, compiling"
if type "sass" > /dev/null 2>&1; then
sass --scss --compass -lC $theme_path/style.scss > $theme_path/style.css;
else
cat $theme_path/style.scss | ssh XXX@YYY.ZZZ \
"sass --scss --compass --no-cache --style compressed" \
> $theme_path/style.css
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment