diff options
Diffstat (limited to 'actionpack/lib/sprockets/helpers/rails_helper.rb')
-rw-r--r-- | actionpack/lib/sprockets/helpers/rails_helper.rb | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/actionpack/lib/sprockets/helpers/rails_helper.rb b/actionpack/lib/sprockets/helpers/rails_helper.rb index 7200ab1ddd..53cc5ec019 100644 --- a/actionpack/lib/sprockets/helpers/rails_helper.rb +++ b/actionpack/lib/sprockets/helpers/rails_helper.rb @@ -26,15 +26,10 @@ module Sprockets sources.collect do |source| if debug && asset = asset_paths.asset_for(source, 'js') asset.to_a.map { |dep| - javascript_include_tag(dep, :debug => false, :body => true) - }.join("\n").html_safe + javascript_include_tag(dep, options.stringify_keys.merge!({ :debug => false, :body => true })) + } else - tag_options = { - 'type' => "text/javascript", - 'src' => asset_path(source, 'js', body) - }.merge(options.stringify_keys) - - content_tag 'script', "", tag_options + super(source.to_s, { 'src' => asset_path(source, 'js', body) }.merge!(options.stringify_keys)) end end.join("\n").html_safe end @@ -47,17 +42,10 @@ module Sprockets 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) - }.join("\n").html_safe + stylesheet_link_tag(dep, options.stringify_keys.merge!({ :debug => false, :body => true })) + } else - tag_options = { - 'rel' => "stylesheet", - 'type' => "text/css", - 'media' => "screen", - 'href' => asset_path(source, 'css', body, :request) - }.merge(options.stringify_keys) - - tag 'link', tag_options + super(source.to_s, { 'href' => asset_path(source, 'css', body, :request) }.merge!(options.stringify_keys)) end end.join("\n").html_safe end @@ -70,12 +58,10 @@ module Sprockets private def debug_assets? - begin + Rails.application.config.assets.allow_debugging && + (Rails.application.config.assets.debug || params[:debug_assets] == '1' || - params[:debug_assets] == 'true' - rescue NoMethodError - false - end || Rails.application.config.assets.debug + params[:debug_assets] == 'true') end # Override to specify an alternative prefix for asset path generation. |