Re: Good solution for managing stylesheets

Frank Manno
Fri, 19 Aug 2005 22:42:42 -0000

Jamis,

Sorry to interject... What does the asterisk (*) in the
stylesheet_link_tag method call do?


Thanks,
Frank

On 8/19/05, Jamis Buck <jamis-uHoyYlH2B+GakBO8gow8eQ@public.gmane.org>
wrote:
> On Aug 19, 2005, at 3:31 PM, Jeffrey Moss wrote:
>
> > Does anybody figure they have the perfect solution for managing
> > stylesheets when using layouts and partials?
> >
> > I''d like a way for each partial to automatically include
something
> > in the header section of the layout, when it is used. Right now I
> > just have the layout setup to include 3 stylesheets, one called
> > "default", another called the controller name, and another
called
> > the action name, but this of course has limitations.
> >
> > I thought there was something in the works to handle this (having
> > things appear in the header that were called in a template or
> > partial), was that idea scrapped? I imagine it presents a few
> > problems, I mean it''s sortof dirty to automatically include
> > stylesheets based on what the page is composed of, I may need to
> > just switch to a controller-based add_stylesheet macro or something...
> >
>
> I''ve done the following in the past. Anytime I have another
> stylesheet I want used (in a partial, for instance), I just do:
>
>    <% (@stylesheets ||= []) << "my_stylesheet" %>
>
> And then in the master layout:
>
>    <% stylesheet_link_tag(*@stylesheets) if @stylesheets %>
>
> It''s simple, easy to extend, and doesn''t require any
special
> infrastructure.
>
> - Jamis
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
- Frank
FrankManno.com

<a
href="http://www.spreadfirefox.com/?q=affiliates&amp;id=2496&amp;t=1">Get
Firefox!