Permalink
Browse files

Merge pull request #11 from lest/patch-1

don't add extension if other given and file exists
  • Loading branch information...
2 parents 1b0d568 + d059722 commit b040b335e0ed71ddbe530e2afbf5e970cac67075 @guilleiguaran guilleiguaran committed May 21, 2012
@@ -158,8 +158,13 @@ def rewrite_asset_path(source, dir, options = {})
end
def rewrite_extension(source, dir, ext)
- if ext && File.extname(source) != ".#{ext}"
- "#{source}.#{ext}"
+ source_ext = File.extname(source)
+ if ext && source_ext != ".#{ext}"
+ if !source_ext.empty? && asset_environment[source]
+ source
+ else
+ "#{source}.#{ext}"
+ end
else
source
end
@@ -304,6 +304,9 @@ def compute_host(source, request, options = {})
assert_match %r{\A<link href="/assets/style-[0-9a-f]+.css" media="screen" rel="stylesheet" />\Z},
stylesheet_link_tag("style", "style")
+ assert_match %r{\A<link href="/assets/style-[0-9a-f]+.ext" media="screen" rel="stylesheet" />\Z},
+ stylesheet_link_tag("style.ext")
+
@config.assets.compile = true
@config.assets.debug = true
assert_match %r{<link href="/stylesheets/application.css" media="screen" rel="stylesheet" />},

0 comments on commit b040b33

Please sign in to comment.