activeadmin: css not getting precompiled
I have a standard Rails 3.1.1.rc1 application set up. The only thing I have done to this point:
- rails new myapp -T -d postgresql
- Edited gemfile to add active_admin and a few other gems
- Moved sass-rails out of assets group as per issue #447
- Set up a very simple index page and set root :to => this page, which has no dynamic content
- migrated the database and run in development mode. Everything runs fine.
- Send the app over to the production server (Apache2, Passenger, Postgresql), migrate database and access the /admin
At this point I get a 500 error. So checking the production log, I get
ActionView::Template::Error (active_admin.css isn't precompiled):
6: <title><%= [@page_title, active_admin_application.site_title].compact.join(" | ") %></title>
7:
8: <% ActiveAdmin.application.stylesheets.each do |path| %>
9: <%= stylesheet_link_tag path %>
10: <% end %>
11: <% ActiveAdmin.application.javascripts.each do |path| %>
12: <%= javascript_include_tag path %>
So, I open up a terminal and do
rake RAILS_ENV=production assets:precompile
And all the assets are compiled, except for the active_admin.css. I can see that the active_admin.css.scss file is in app/assets/stylesheets but for some reason it is being skipped.
Here is the gemfile:
gem 'rails', '3.1.1.rc1'
gem 'pg'
gem 'sass-rails', " ~> 3.1.0"
group :assets do
gem 'therubyracer'
# gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'ancestry'
gem 'cancan', :git => "git://github.com/ryanb/cancan.git", :branch => "2.0"
gem 'friendly_id'
gem 'role_model'
gem 'activeadmin'
group :development, :test do
gem 'guard-rspec'
end
group :development do
gem 'rspec-rails'
gem 'unicorn'
gem 'capistrano'
end
group :test do
gem 'rspec'
gem 'webrat'
gem 'factory_girl_rails'
end
Other than the above gemfile and very basic index page I have made no modifications to the application.
About this issue
- Original URL
- State: closed
- Created 13 years ago
- Reactions: 1
- Comments: 63 (27 by maintainers)
Commits related to this issue
- Set compile to true https://github.com/activeadmin/activeadmin/issues/483 — committed to raysapida/treebook by raysapida 9 years ago
This worked for me thanks.
@giedriusr It worked for me after adding
config.assets.compile = true
and the configuration discussed in this issue
Adding
config.assets.precompile
didn’t work for me but the following did (still in production.rb):config.assets.compile = true
(found here: https://github.com/rails/rails/issues/2765#issuecomment-1957155)
Add the following line to your config/environments/production.rb:
btw, it is a good idea to add that note to readme of activeadmin