[Rails] Re: CSS in Views
by Alan Francis other posts by this author
Feb 14 2006 5:47AM messages near this date
[Rails] Re: CSS in Views
|
Re: [Rails] Re: CSS in Views
Michael Boutros wrote:
> Andrew Otwell wrote:
> >>How can I link to a CSS file in one of my view files?
> >
> > Typically you do this in your layouts:
> >
> > <%= stylesheet_link_tag "filename", :media => "all" %>
> >
> > More here: http://rails.rubyonrails.com/classes/ActionView/Helpers/
> > AssetTagHelper.html#M000397
>
> I just tried this and in the source it is looking for
> /stylesheets/filename. In RadRails you cannot create folders, so I
> created the folder in explorer and moved the style.css file into that
> folder, but it still is not reading it. Also, I have changed filename to
> style.css. Thanks :)
If your css file is living in myrailsapp/public/stylesheets and is
called mystylesheet.css, you would use <%= stylesheet_link_tag
"mystylesheet", :media => "all" %>
The string you pass is the name of the file, minus the extension. Since
your file is called style.css, you should use <%= stylesheet_link_tag
"style" %> .
Is this any clearer ?
A.
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Rails mailing list
Rails@[...].org
http://lists.rubyonrails.org/mailman/listinfo/rails
Thread:
Michael Boutros
Andrew Otwell
Michael Boutros
Alan Francis
Tony Collen
Mark Wilden
Ben Munat
Ken Kousen
Ben Munat
Michael Boutros
|