Skip to content

Instantly share code, notes, and snippets.

@annedorko
Last active February 27, 2017 09:01
Show Gist options
  • Save annedorko/483f866c150b8653dab4659f00e904a0 to your computer and use it in GitHub Desktop.
Save annedorko/483f866c150b8653dab4659f00e904a0 to your computer and use it in GitHub Desktop.
post-receive hook for deploying Twist themes
GIT_REPO=/PATH/TO/SITE/PARENT/deploy.git
TMP_GIT_CLONE=/PATH/TO/SITE/PARENT/tmp
PUBLIC_WWW=/PATH/TO/SITE/PARENT/public_html/wp-content/themes/THEME/
# Clone repo into a temporary folder
git clone $GIT_REPO $TMP_GIT_CLONE
# Generate style.css
sass $TMP_GIT_CLONE/_scss/style.scss:$TMP_GIT_CLONE/style.css --style compressed
# Remove extraneous files, delete current public theme
rm -Rf $TMP_GIT_CLONE/_scss/ $TMP_GIT_CLONE/style.css.map $PUBLIC_WWW
# Recreate directory for theme
mkdir -p $PUBLIC_WWW
# Move updated files to the theme folder
mv $TMP_GIT_CLONE/* $PUBLIC_WWW
# Delete temporary files
rm -Rf $TMP_GIT_CLONE
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment