Skip to content

Instantly share code, notes, and snippets.

@ches
Created August 14, 2011 07:29
Show Gist options
  • Save ches/1144671 to your computer and use it in GitHub Desktop.
Save ches/1144671 to your computer and use it in GitHub Desktop.
Reusing Guard tasks via Rake
# There are a couple minor quirks (see https://github.com/guard/guard/issues/118),
# but mostly this is delightfully straightforward:
require 'guard'
namespace :assets do
desc 'Generate CSS from all source LESS files'
task :less do
Guard.setup
Guard::Dsl.evaluate_guardfile(:guardfile => 'Guardfile', :group => ['frontend'])
# Would be nice if these were in a hash keyed by name:
less = Guard.guards.select { |g| g.is_a? Guard::Less }.first
less.run_all
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment