Skip to content

Instantly share code, notes, and snippets.

@radicaled
Created April 6, 2011 04:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radicaled/905157 to your computer and use it in GitHub Desktop.
Save radicaled/905157 to your computer and use it in GitHub Desktop.
A config initializer for Rails 3 + Heroku
unless Rails.env.development?
require 'fileutils'
output_folder = Rails.root.join("tmp", "jammit", "assets")
FileUtils.mkdir_p(output_folder)
# Heroku specific hack.
Jammit::Packager.class_eval do
def glob_files_with_heroku_hack(glob)
paths = glob_files_without_heroku_hack(glob)
# Heroku has a magical "public/javascripts/all.js" file. It is a Mystery.
paths.reject { |path| path =~ /javascripts\/all.js$/ }
end
alias_method_chain :glob_files, :heroku_hack
end
Jammit.package! :output_folder => output_folder
Rails.configuration.middleware.insert_before('Rack::Sendfile', 'Rack::Static',
:urls => ['/assets'],
:root => "#{Rails.root}/tmp/jammit")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment