I have a stylesheet, application.css defined in layouts/application.html.erb:
<%= stylesheet_link_tag "application" %>
However, there’s a section of the site where the views will use a completely different stylesheet, dashboard.css which I’ve defined in its index.html.erb:
<head>
<title>My title</title>
<%= stylesheet_link_tag "dashboard" %>
..
Unless I remove the stylesheet_link_tag in the application layout file, there are conflicts which make the dashboard view weird. If I move the application layout stylesheet tag to a _header.html.erb partial which is rendered with every view in the non-dashboard section like below, it doesn’t work. How must I call them?
<%= stylesheet_link_tag "application" %>
<header>
<div id="headercontainer">
..
Create a separate layout for your dashboard, with specific stylesheets.
If you want customized stylesheet for one of your controllers (and all of its actions), it’s quite easy to do. Create a layout with matching name, that is, for your
users_controller, template name should beusers.html.erb.Also you can specify any layout for controller.
If you want custom stylesheet only for some actions, specify corresponding layout in call to
render.