Skip to content
This repository
Browse code

Make explicit the default media when calling stylesheet_tag and chang…

…e the default generators.
  • Loading branch information...
commit 05e02deb686fc21f99c2d1dcf3abc987796e0e19 1 parent cb06727
Marc-André Lafortune authored
3  actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb
@@ -68,6 +68,9 @@ def stylesheet_path(source)
68 68
         # Returns a stylesheet link tag for the sources specified as arguments. If
69 69
         # you don't specify an extension, <tt>.css</tt> will be appended automatically.
70 70
         # You can modify the link attributes by passing a hash as the last argument.
  71
+        # For historical reasons, the 'media' attribute will always be present and defaults
  72
+        # to "screen", so you must explicitely set it to "all" for the stylesheet(s) to
  73
+        # apply to all media types.
71 74
         #
72 75
         # ==== Examples
73 76
         #   stylesheet_link_tag "style" # =>
2  railties/guides/code/getting_started/app/views/layouts/application.html.erb
@@ -2,7 +2,7 @@
2 2
 <html>
3 3
 <head>
4 4
   <title>Blog</title>
5  
-  <%= stylesheet_link_tag    "application" %>
  5
+  <%= stylesheet_link_tag    "application", :media => "all" %>
6 6
   <%= javascript_include_tag "application" %>
7 7
   <%= csrf_meta_tags %>
8 8
 </head>
2  railties/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt
@@ -2,7 +2,7 @@
2 2
 <html>
3 3
 <head>
4 4
   <title><%= camelized %></title>
5  
-  <%%= stylesheet_link_tag    "application" %>
  5
+  <%%= stylesheet_link_tag    "application", :media => "all" %>
6 6
   <%%= javascript_include_tag "application" %>
7 7
   <%%= csrf_meta_tags %>
8 8
 </head>
2  railties/lib/rails/generators/rails/plugin_new/templates/app/views/layouts/%name%/application.html.erb.tt
@@ -2,7 +2,7 @@
2 2
 <html>
3 3
 <head>
4 4
   <title><%= camelized %></title>
5  
-  <%%= stylesheet_link_tag    "<%= name %>/application" %>
  5
+  <%%= stylesheet_link_tag    "<%= name %>/application", :media => "all" %>
6 6
   <%%= javascript_include_tag "<%= name %>/application" %>
7 7
   <%%= csrf_meta_tags %>
8 8
 </head>

0 notes on commit 05e02de

Please sign in to comment.
Something went wrong with that request. Please try again.