Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Backport of Rails 3.1.x Sprockets integration to Rails 3.0.x

branch: master
Octocat-spinner-32 lib documentation fixes January 04, 2012
Octocat-spinner-32 .gitignore v0.0.3 December 13, 2011
Octocat-spinner-32 Gemfile first December 01, 2011
Octocat-spinner-32 MIT-LICENSE first December 01, 2011
Octocat-spinner-32 README.markdown update README again January 04, 2012
Octocat-spinner-32 sprockets_rails3_backport.gemspec v0.0.4 December 16, 2011
README.markdown

Backport of Rails 3.1.x Sprockets integration to Rails 3.0.x

Most code has been extracted from the Rails 3-1-stable branch. Modified to suit our needs.

Usage

In your Gemfile:

gem "sprockets_rails3_backport"

...plus whatever supplementary gems you want for the asset pipeline:

gem 'coffee-script', '2.2.0'
gem 'therubyracer', '0.9.9'
gem 'uglifier', '>= 1.0.3'

In your routes.rb:

MyApp::Application.routes.draw do
  if (app = Rails.application).config.assets.compile
    mount app.assets => app.config.assets.prefix
  end

  # ...
end

Here are the various config.assets options and their defaults:

config.assets.paths                    = []
config.assets.precompile               = [ Proc.new{ |path| !['.js', '.css'].include?(File.extname(path)) },
                                           /(?:\/|\\|\A)application\.(css|js)$/ ]
config.assets.prefix                   = "/assets"
config.assets.version                  = ''
config.assets.debug                    = false
config.assets.compile                  = true
config.assets.digest                   = false
config.assets.manifest                 = nil
config.assets.cache_store              = [ :file_store, "#{root}/tmp/cache/assets/" ]
config.assets.js_compressor            = nil
config.assets.css_compressor           = nil
config.assets.initialize_on_precompile = true

Differences from Rails 3.1

This gem was made for Shopify's use, and I've made changes to some behaviour that either didn't work in Rails 3.0, or didn't make sense for Shopify:

Something went wrong with that request. Please try again.