Skip to content

Instantly share code, notes, and snippets.

@stdekker
Last active August 29, 2015 14:00
Show Gist options
  • Save stdekker/11292518 to your computer and use it in GitHub Desktop.
Save stdekker/11292518 to your computer and use it in GitHub Desktop.
Drupal theme + compass + guard + livereload

Make sure you have installed drush and the proper Guard extensions (shell, compass and livereload)

# ~/.guardfile
# Based on work by: https://gist.github.com/dvessel
# More info at https://github.com/guard/guard#readme
notification :off
puts "Using default guard file."
group :development do
if File.exists?("./config.rb")
# Compile on start.
puts `compass compile --time --quiet`
# https://github.com/guard/guard-compass
guard :compass do
watch(%r{(.*)\.s[ac]ss$})
end
end
## Clear caches on update of info-file
if Dir.glob("*.info").any?
guard :shell do
puts 'Monitoring theme info file.'
watch(%r{.*\.info$}) { |m|
puts 'Change detected: ' + m[0]
`drush cache-clear "theme-registry" -y`
puts 'Cleared info caches.'
}
end
end
# https://github.com/guard/guard-livereload.
guard :livereload do
watch(%r{.+\.(scss|css|js|html?|php|inc|theme)$})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment