Reputation: 14879
I have a new project, and I have created 2 layouts for it.
The 1st layout is the main layout used for the application.
The 2nd layout is for the 'beta' landing page, where users can signup via email to recieve updates on the website. I am using bootstrap for this section.
My assets folder looks like:
/assets/
/assets/bootstrap/
/assets/.... (default folders generated by rails 4)
Is it possible for asset pipeline to server the assets for the 'beta' layout from the /assets/bootstrap tree?
Upvotes: 0
Views: 84
Reputation: 1144
You will have to use two layout files in app/views/layouts
: one you just leave like it is and then you create a second that will be called something like application_bootstrap.html.erb
. In the second one you will include a stylesheet link tag like <%= stylesheet_link_tag "bootstrap" %>
. In the assets
directory you will have the regular application.css
where you have to make sure not to include the assets/bootstrap
directory and a new bootstrap.css
which simply requires the assets/bootstrap/
tree to be included.
Then in you controllers you can switch the layouts: layout application_bootstrap
and it will include the new layout file which in return includes the new CSS that you created. Of course you could also switch the layout in the application_controller.rb
based on user settings or whatever you choose.
Upvotes: 1