Skip to content

Instantly share code, notes, and snippets.

@jsahlen
Created February 14, 2012 15:14
Show Gist options
  • Save jsahlen/1827478 to your computer and use it in GitHub Desktop.
Save jsahlen/1827478 to your computer and use it in GitHub Desktop.
My Guard-based build system for front-end assets – see my blog post at http://monospace.se/posts/guard-build-system
gzip_assets: off
javascript_compressor: uglifier
javascripts:
javascripts/site.min:
- javascripts/src/vendor/jquery.js
- javascripts/src/lib/*.js
- javascripts/src/site.js
stylesheets:
stylesheets/site.min:
- stylesheets/site.css
source :rubygems
# V8 JavaScript Engine (for Uglifier)
gem "therubyracer"
# SASS & Compass
gem "sass", "~> 3.2.0.alpha"
gem "compass"
# For concatenation/compression
gem "jammit"
gem "uglifier"
# Guard and plugins
gem "guard"
gem "guard-sass"
gem "guard-jammit"
gem "guard-livereload"
# Mac-specific stuff
if RUBY_PLATFORM =~ /darwin/i
gem "rb-fsevent"
end
guard :sass,
:input => "stylesheets/src",
:output => "stylesheets",
:line_numbers => true,
:load_paths => Dir.glob('**/**').find_all { |i| File.directory?(i) } << "#{Gem.loaded_specs['compass'].full_gem_path}/frameworks/compass/stylesheets"
guard :jammit,
:config_path => "assets.yml",
:output_folder => "." do
watch(%r{(?:stylesheets|javascripts)(/.+)\.(?:css|js)}) { |m| m[0] unless m[1] =~ /\/\./ }
end
guard :livereload,
:apply_js_live => false do
watch(%r{(.+)\.(?:html|php)}) { |m| m[0] unless m[1] =~ /^\./ || m[1] =~ /\/\./ }
watch(%r{(?:stylesheets|javascripts)(/.+)\.(?:css|js)}) { |m| m[0] unless m[1] =~ /\/\./ }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment