views:

380

answers:

4

Where should i create a folder to house my CSS files within my rails app directory??

+11  A: 

public/stylesheets

Ben Hughes
so then how do you link to this stylesheet??
zPesk
either <%= stylesheet_link_tag 'file' %> or use a regular link to the path /stylesheets/file.css .
Ben Hughes
If you had a stylesheet named foo.css, you would put this in the head section of whatever view needed it. <%= stylesheet_link_tag "foo" %>
Joel Meador
+2  A: 

put it in public/stylesheets

then use

<%= stylesheet_link_tag "style_sheet_file_name" %>

in your

Jason Miesionczek
+2  A: 

/app is for programmatic content (your models, views, controllers, layouts, partials, etc). /public is for your static content (html, images, stylesheets, javascripts, etc)

so the correct place for your stylesheets would be /public/stylesheets. If you follow this convention, you can use the stylesheetlink_link_tag helper, so if you put style.css into /public/stylesheets, then

stylesheet_link_tag "style"

will get rendered as

<link href="/stylesheets/style.css?1232285206" media="screen" rel="stylesheet" type="text/css" />
Matt Briggs
A: 

stylesheet_link_tag takes arrays of stylesheets as well as a string.

For example:

= stylesheet_link_tag %w[ screen print ]

There are some great examples of using the stylesheet_link_tag helper at APIDock.

James Conroy-Finn