I just switched from Ruby on Rails 3.0.10 to 3.1.0 and I am using jQuery UI 1.8.14. I have a problem to load css
files in production mode on the remote machine.
In my app/views/layouts/application.html.erb
file I have:
<%= stylesheet_link_tag 'application', 'jquery-ui-1.8.14.custom', 'jquery-ui-1.8.14.custom_redefinition' %>
<%= javascript_include_tag 'application' %>
Note: the jquery-ui-1.8.14.custom
file is the CSS file generated by using the Theme Roller and the jquery-ui-1.8.14.custom_redefinition
is my "custom redefinition" file that override some CSS classes. These files (both with the extension .css
) are located at vendor/assets/stylesheets
.
In development mode on my local machine all seems to work, but when I deploy with Capistrano to the remote machine it doesn't work anymore. That is, the jQuery UI related files are not loaded as expected: if I try to access them, them content is blank\empty (I can see that in the source HTML code generated for my application web pages).
How can I solve that?
At this time in my config/environments/production.rb
file I have:
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
#
# Note: Since, at this time, the asset Pipeline doesn't work for me I am
# following the "Live Compilation" approach (more info at
# http://guides.rubyonrails.org/asset_pipeline.html#in-production)
config.assets.compile = true
# Generate digests for assets URLs
config.assets.digest = true
In my app/assets/stylesheets/application.css.scss
file I have:
/*
*= require_self
*= require_tree .
*/
In my app/assets/stylesheets/application.js
file I have:
//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require_tree .
Before deploy, in my local machine, I run the following command:
bundle exec rake assets:precompile
Note: if I run the above command, jquery-ui-1.8.14.custom
and jquery-ui-1.8.14.custom_redefinition
files are generated in the public/assets
directory as expected.
Maybe the problem is related to the require_tree .
statement in the app/assets/stylesheets/application.css.scss
file that doesn't not load files present in the vendor/assets/stylesheets
directory.