Permalink
Browse files

Merge pull request #2668 from guilleiguaran/debug-assets-media-type

Debug assets shouldn't ignore media type for stylesheets. Closes #2625
  • Loading branch information...
1 parent 1fdae97 commit d15e7aa368b738645280baa94a5c377b38ece985 @spastorino spastorino committed Aug 24, 2011
@@ -43,17 +43,18 @@ def stylesheet_link_tag(*sources)
options = sources.extract_options!
debug = options.key?(:debug) ? options.delete(:debug) : debug_assets?
body = options.key?(:body) ? options.delete(:body) : false
+ media = options.key?(:media) ? options.delete(:media) : "screen"
sources.collect do |source|
if debug && asset = asset_paths.asset_for(source, 'css')
asset.to_a.map { |dep|
- stylesheet_link_tag(dep, :debug => false, :body => true)
+ stylesheet_link_tag(dep, :media => media, :debug => false, :body => true)
}.join("\n").html_safe
else
tag_options = {
'rel' => "stylesheet",
'type' => "text/css",
- 'media' => "screen",
+ 'media' => media,
'href' => asset_path(source, 'css', body, :request)
}.merge(options.stringify_keys)
@@ -203,6 +203,9 @@ def url_for(*args)
@config.assets.debug = true
assert_match %r{<link href="/assets/style-[0-9a-f]+.css\?body=1" media="screen" rel="stylesheet" type="text/css" />\n<link href="/assets/application-[0-9a-f]+.css\?body=1" media="screen" rel="stylesheet" type="text/css" />},
stylesheet_link_tag(:application)
+
+ assert_match %r{<link href="/assets/style-[0-9a-f]+.css\?body=1" media="print" rel="stylesheet" type="text/css" />\n<link href="/assets/application-[0-9a-f]+.css\?body=1" media="print" rel="stylesheet" type="text/css" />},
+ stylesheet_link_tag(:application, :media => "print")
end
test "alternate asset prefix" do

0 comments on commit d15e7aa

Please sign in to comment.