I have a huge project with rails 3.1 (without assets pipeline). This project has a lot of different layouts, for example:
And etc. Each layout has a huge list of js and css (to attach them we use javascript_include_tag
and stylesheet_link_tag
). Is it possible to enable assets pipeline so it will include different js/css files for different layouts and it will generate different application.js and application.css for each layout in production?
yes it is
application.css
*= require this_file
*= require that_file
home.css
*= require this_file
*= require home_file
etc etc
you can then do this in your application layout:
<%= stylesheet_link_tag "application", media: "all" %>
and the home layout
<%= stylesheet_link_tag "home", media: "all" %>
you will also need to tweak production.rb
config.assets.precompile += %w( application.css home.css home.js )
including all the compiled files you reference in the layouts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With