I think there is a problem with the handling of media in the stylesheet tag. In my layout file I have: <%= stylesheet_link_tag "simple", "list", :media => "all" %> Which results in: <link href="/stylesheets/simple.css" media="screen" rel="Stylesheet" type="text/css" /> <link href="/stylesheets/list.css" media="screen" rel="Stylesheet" type="text/css" /> <link href="/stylesheets/mediaall.css" media="screen" rel="Stylesheet" type="text/css" /> You see problem? I see problem :-). According to Agile Rails book I am doing it right. But maybe I am missing something. Any suggestions?
The latest stable Rails doesn''t accept the :media option and always outputs media="screen", maybe the book refers to the current beta version? On 6/30/05, John Kopanas <john.kopanas-O1KSuMybMhqBUy7/sJONFg@public.gmane.org> wrote:> > I think there is a problem with the handling of media in the > stylesheet tag. In my layout file I have: > > <%= stylesheet_link_tag "simple", "list", :media => "all" %> > > Which results in: > > <link href="/stylesheets/simple.css" media="screen" rel="Stylesheet" > type="text/css" /> > <link href="/stylesheets/list.css" media="screen" rel="Stylesheet" > type="text/css" /> > <link href="/stylesheets/mediaall.css" media="screen" > rel="Stylesheet" type="text/css" /> > > You see problem? I see problem :-). > > According to Agile Rails book I am doing it right. But maybe I am > missing something. > > Any suggestions? > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Rafael Rezende _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Looks like it was added after 0.12.1 was released: http://dev.rubyonrails.com/changeset/1281 The book goes by what Rails 1.0 will be. I just tried this with the latest from subversion, and it works fine. On 6/30/05, Rafael Rezende <rrezende-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> The latest stable Rails doesn''t accept the :media option and always outputs > media="screen", maybe the book refers to the current beta version? > > > On 6/30/05, John Kopanas <john.kopanas-O1KSuMybMhqBUy7/sJONFg@public.gmane.org> wrote: > > I think there is a problem with the handling of media in the > > stylesheet tag. In my layout file I have: > > > > <%= stylesheet_link_tag "simple", "list", :media => "all" %> > > > > Which results in: > > > > <link href="/stylesheets/simple.css" media="screen" rel="Stylesheet" > > type="text/css" /> > > <link href="/stylesheets/list.css" media="screen" rel="Stylesheet" > > type="text/css" /> > > <link href="/stylesheets/mediaall.css" media="screen" > > rel="Stylesheet" type="text/css" /> > > > > You see problem? I see problem :-). > > > > According to Agile Rails book I am doing it right. But maybe I am > > missing something. > > > > Any suggestions? > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > -- > Rafael Rezende > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-- rick http://techno-weenie.net
Rick Olson wrote:> The book goes by what Rails 1.0 will be. I just tried this with the > latest from subversion, and it works fine.Perhaps I just don''t get this yet, but there are certain aspects of my code I would still like a bit more direct control over. For example, often with stylesheets I use the @import directive to protect older browsers from advanced CSS they don''t understand: <style type="text/css" media="screen, projection" title="My Stylesheet">@import "layout.css";</style> I also use the normal stylesheet links to hand some CSS (the text styling etc.) to the older browsers, and for print stylesheets too. Perhaps I just need to extend the stylesheet_link_tag helper to allow more advanced possibilities? Does anyone else do stuff like this on a regular basis too? I have a very specific way I work with stylesheets, and I''m just not sure the inbuilt Rails stuff goes far enough for my needs. I guess there''s nothing really to stop me just putting my own raw stylesheet links in, but the asset helpers are better at handing paths and so on, right? Any more advantages to using them? Cheers, ~Dave -- Dave Silvester Rent-A-Monkey Website Development Web: http://www.rentamonkey.com/
> Perhaps I just don''t get this yet, but there are certain aspects of my code I > would still like a bit more direct control over. For example, often with > stylesheets I use the @import directive to protect older browsers from > advanced CSS they don''t understand: > > <style type="text/css" media="screen, projection" title="My > Stylesheet">@import "layout.css";</style> > > I also use the normal stylesheet links to hand some CSS (the text styling > etc.) to the older browsers, and for print stylesheets too. Perhaps I just > need to extend the stylesheet_link_tag helper to allow more advanced > possibilities? > > Does anyone else do stuff like this on a regular basis too? I have a very > specific way I work with stylesheets, and I''m just not sure the inbuilt Rails > stuff goes far enough for my needs. > > I guess there''s nothing really to stop me just putting my own raw stylesheet > links in, but the asset helpers are better at handing paths and so on, right? > Any more advantages to using them?I''m sure a helper like <%= stylesheet_import_tag ''layout'', ''styles'', :media => ''screen, projection'', :title => ''My Stylesheet'' %> to <style type="text/css" media="screen, projection" title="My Stylesheet"> @import "layout.css"; @import "styles.css"; </style> would be simple to write, and I can''t imagine it being rejected as long as it was very simple and didn''t break any other helpers. For more advanced usage, use the stylesheet_path helper to get your stylesheet urls. <style type="text/css" media="screen, projection" title="My Stylesheet"> @import ''<%= stylesheet_path ''layout'' %>''; </style> -- rick http://techno-weenie.net
John Kopanas wrote:> I think there is a problem with the handling of media in the stylesheet > tag. In my layout file I have: > > <%= stylesheet_link_tag "simple", "list", :media => "all" %> > > Which results in: > > <link href="/stylesheets/simple.css" media="screen" rel="Stylesheet" > type="text/css" /> > <link href="/stylesheets/list.css" media="screen" rel="Stylesheet" > type="text/css" /> > <link href="/stylesheets/mediaall.css" media="screen" rel="Stylesheet" > type="text/css" /> > > You see problem? I see problem :-). > > According to Agile Rails book I am doing it right. But maybe I am > missing something.In the second beta of the Agile Rails book, Dave Thomas started using Rails features that required Rails beta gems. So when I made some suggestions for improving the use of styles (e.g. fixing the IE layout problem, specifying media="all") I was working with the beta gems. Those changes appeared in the third beta of the book, and I assume that the Rails features that are currently in the beta gems will be in the 0.13 release, due (apparently) Real Soon Now. Justin