Skip to content

Instantly share code, notes, and snippets.

@jejacks0n
Created May 25, 2011 01:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save jejacks0n/990160 to your computer and use it in GitHub Desktop.
Save jejacks0n/990160 to your computer and use it in GitHub Desktop.
Adding sprockets to evergreen for rails 3.1 and coffeescript (via /config/evergreen.rb)
# For Rails 3.1 asset packaging / sprockets support
# 1. Create a /config/evergreen.rb file and put these contents in it
# 2. Adjust the paths below (the provided ones are generic)
require ::File.expand_path('../application', __FILE__)
module Evergreen
class << self
def application_with_additions(suite)
app = application_without_additions(suite)
app.map "/assets" do
assets = Rails.application.config.assets
if assets.enabled
paths = %W{app/assets/javascripts lib/assets/javascripts vendor/assets/javascripts}.map{ |p| File.join(suite.root, p) }
require 'sprockets'
sprockets = Sprockets::Environment.new(suite.root) do |env|
paths.each { |path| env.append_path(path) }
env.js_compressor = nil
end
run sprockets
end
end
app
end
alias_method :application_without_additions, :application
alias_method :application, :application_with_additions
end
end
@timoxley
Copy link

Is there something else I need to do to get this to work? I've got it in config/evergreen.rb, but sprockets doesn't appear to be doing anything

@jejacks0n
Copy link
Author

This is deprecated.. evergreen 1.0.0 has had this integrated more fully, and that should be used instead.

@timoxley
Copy link

Great, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment