Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Guard for compiling sprockets assets
tag: v0.0.2

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples
features
lib/guard
spec
.gitignore
.rspec
Gemfile
LICENSE
README.md
Rakefile
guard-sprockets2.gemspec

README.md

Guard Sprockets 2

A Guard for Sprockets 2 that works with Rails, Sinatra or any other Rack app.

Usage

Add it to your Gemfile:

gem 'guard-sprockets2'

Add the guard definition to your Guardfile:

bundle exec guard init sprockets2

Configure guard for your environment. The following options are available:

  • sprockets - Required. Set it to an instance of Sprockets::Environment
  • assets_path - Optional. The compiled assets path. Defaults to public/assets
  • precompile - Optional. An array of regex's or strings which match files that need compiling. Defaults to [ /\w+\.(?!js|css).+/, /application.(css|js)$/ ]

Example Rails and Sinatra apps can be found in the examples directory.

Rails

When Rails is loaded the defaults come from Rails' configuration, so no additional configuration is necessary.

require './config/environment'

guard 'sprockets2' do
  watch(%r{^app/assets/.+$})
  watch('config/application.rb')
end

Sinatra

require './app'

guard 'sprockets2', :sprockets => App.sprockets do
  watch(%r{^assets/.+$})
  watch('app.rb')
end
Something went wrong with that request. Please try again.