Skip to content

Instantly share code, notes, and snippets.

@hoverlover
Created June 7, 2011 16:35
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save hoverlover/1012619 to your computer and use it in GitHub Desktop.
Save hoverlover/1012619 to your computer and use it in GitHub Desktop.
Rails initializer for using ActiveAdmin with Sass on Heroku
if Rails.env.production?
require 'fileutils'
FileUtils.mkdir_p(Rails.root.join("tmp", "stylesheets", "admin"))
template_path_one = "#{Gem.loaded_specs['activeadmin'].full_gem_path}/app/assets/stylesheets"
template_path_two = "#{Gem.loaded_specs['activeadmin'].full_gem_path}/lib/active_admin/sass"
old_compile_path = "#{Rails.root}/public/stylesheets/admin"
new_compile_path = "#{Rails.root}/tmp/stylesheets/admin"
Sass::Plugin::remove_template_location template_path_one
Sass::Plugin::add_template_location template_path_one, new_compile_path
Sass::Plugin::remove_template_location template_path_two
Sass::Plugin::add_template_location template_path_two, new_compile_path
end
@jevy
Copy link

jevy commented Jun 8, 2011

Works for me. Thanks for contributing!

@hoverlover
Copy link
Author

Revision 241545 of this gist is for version 5b534e18 of ActiveAdmin master. Use gist revision d7b763 for ActiveAdmin version 0.2.2.

@dinhhai
Copy link

dinhhai commented Aug 9, 2011

i used this gist together with http://devcenter.heroku.com/articles/using-sass

problem solved.

@bantic
Copy link

bantic commented Nov 23, 2011

Thanks, this fixed for me, too.

@martinstreicher
Copy link

Does this error look familiar? I tried this patch to no avail.

ActionView::Template::Error (active_admin.css isn't precompiled):
2012-08-01T22:37:54+00:00 app[web.1]: 6: <title><%= [@page_title, active_admin_application.site_title].compact.join(" | ") %></title>
2012-08-01T22:37:54+00:00 app[web.1]: 7:
2012-08-01T22:37:54+00:00 app[web.1]: 8: <% ActiveAdmin.application.stylesheets.each do |style| %>

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