method
javascript_include_tag
v3.1.0 -
Show latest stable
- Class:
Sprockets::Helpers::RailsHelper
javascript_include_tag(*sources)public
No documentation available.
# File actionpack/lib/sprockets/helpers/rails_helper.rb, line 22
def javascript_include_tag(*sources)
options = sources.extract_options!
debug = options.key?(:debug) ? options.delete(:debug) : debug_assets?
body = options.key?(:body) ? options.delete(:body) : false
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
else
tag_options = {
'type' => "text/javascript",
'src' => asset_path(source, 'js', body)
}.merge(options.stringify_keys)
content_tag 'script', "", tag_options
end
end.join("\n").html_safe
end