Richlewis
Richlewis

Reputation: 15374

Calling stylesheets in Rails 3.1

Im not sure if this is the best way to do things in rails 3.1 but I am trying to organise my CSS so that its not in one big file I.e. application.css, so instead I am creating page specific views and calling like so

<%= stylesheet_link_tag    "application", "gallery", "home" %>

Now what I have noticed is that no matter what page you are on it will call all the css within the stylesheet? Is there a way to call just the CSS relevant to that page, or say call just the application and gallery page for example? or am I going about this the wrong way, is there a more efficient way?

All advice appreciated

Upvotes: 1

Views: 115

Answers (1)

Jonathan
Jonathan

Reputation: 11494

In application.css you get

*= require_self
*= require_tree .

Remove the line for *= require_tree . and you will no longer have it dragging in everything else automatically.

Upvotes: 2

Related Questions