lib/sprockets/helpers/rails_helper.rb in actionpack-3.2.3 vs lib/sprockets/helpers/rails_helper.rb in actionpack-3.2.4.rc1

- old
+ new

@@ -29,11 +29,11 @@ super(dep.pathname.to_s, { :src => path_to_asset(dep, :ext => 'js', :body => true, :digest => digest) }.merge!(options)) } else super(source.to_s, { :src => path_to_asset(source, :ext => 'js', :body => body, :digest => digest) }.merge!(options)) end - end.join("\n").html_safe + end.uniq.join("\n").html_safe end def stylesheet_link_tag(*sources) options = sources.extract_options! debug = options.key?(:debug) ? options.delete(:debug) : debug_assets? @@ -46,11 +46,11 @@ super(dep.pathname.to_s, { :href => path_to_asset(dep, :ext => 'css', :body => true, :protocol => :request, :digest => digest) }.merge!(options)) } else super(source.to_s, { :href => path_to_asset(source, :ext => 'css', :body => body, :protocol => :request, :digest => digest) }.merge!(options)) end - end.join("\n").html_safe + end.uniq.join("\n").html_safe end def asset_path(source, options = {}) source = source.logical_path if source.respond_to?(:logical_path) path = asset_paths.compute_public_path(source, asset_prefix, options.merge(:body => true)) @@ -153,11 +153,16 @@ source end 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 end end