Reputation: 118271
I had put many css files in the file active_admin.css.scss :
// Active Admin's got SASS!
@import "active_admin/mixins";
@import "active_admin/base";
@import "admin/plugins/*";
@import "admin/calendar";
@import "jquery-ui.css";
@import "admin/jquery.datepick.css";
But the files "jquery-ui.css"
and "admin/jquery.datepick.css"
are creating problems. I am getting the 404 Not Found error in the browser console for below :
http://staging.xxx.com/assets/jquery-ui.css
http://staging.xxx.com/assets/admin/jquery.datepick.css
I also checked the assets in browsers, these 2 files are present, but they don't have content inside it. I am using Nginx as my webserver in Ec2. All is working in development, but not in production.
My Ngnix is configured as mentioned in this answer. I am using Capistrano
to deploy. Everything is working but not those 2 files.
I have the below settings in production.rb too :
config.assets.compile = true
config.assets.precompile += %w[active_admin.css active_admin.js]
And still it didn't work. I found the above suggestion from here.
Upvotes: 4
Views: 1410
Reputation: 29291
Get rid of the file extensions in your @import
declarations. It should be:
@import "jquery-ui";
@import "admin/jquery.datepick";
Upvotes: 1
Reputation: 3057
I don't know if this is a complete answer, but I can't post a formatted code snippet unless it's in the "answer" section, so here we go.
My theory is your missing files are not being included in your precompile and perhaps this would help. My assets .precompile statements are not in production.rb, rather are in assets.rb and look like this:
# assets.rb
# Be sure to restart your server when you modify this file.
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
Rails.application.config.assets.precompile += %w( mapworkers.js )
Rails.application.config.assets.precompile += %w( prototype.js )
In production.rb
# production.rb
# Disable Rails's static asset server (Apache or nginx will already do this).
config.serve_static_files = false
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Generate digests for assets URLs.
config.assets.digest = true
Additional debug idea: As a person wth 65k rep, I doubt you need my debug advice, but in particular my own Rails server setup is Nginx with Unicorn. I have been manually deploying because I my first deploy I wanted to get the app launched in the most direct manner, and then add complexity with components like Capistrano. If you find this problem intractable, cut out Capistrano altogether and deploy manually and see if you get your files where they need to be without it, then roll Cap back in and see if it breaks anything.
Upvotes: 1