app/helpers/asset_helper.rb
# Generates a SCRIPT tag for the given JS file. By default, this will set both ASYNC and DEFER attributes.
#
# === Parameters
#
# [filename] _(string)_ the name of the file to link to
# [options] _(hash, optional)_ any additional attributes to be set on the tag
Generates a SCRIPT tag for the given JS file. By default, this will set both ASYNC and DEFER attributes.
Parameters

[filename] _(string)_ the name of the file to link to
[options] _(hash, optional)_ any additional attributes to be set on the tag
Generates a SCRIPT tag for the given JS file . By default this will set both ASYNC and DEFER attributes . Parameters [ filename ] _ ( string ) _ the name of the file to link to [ options ] _ ( hash optional ) _ any additional attributes to be set on the tag
def script_tag( filename, options = {} )
    filename = filename.to_s
    filename += '.js' unless filename.end_with?( '.js' )
    options[:src]   = asset_url_for( filename )
    options[:defer] = :defer unless options.key?( :defer )
    options[:async] = :async unless options.key?( :async )
    ( tag( :script, options, true ).gsub( /(?<attr>[a-z]+)=\"\k<attr>\"/, '\k<attr>' ) + '</script>' ).html_safe
  end
def script_tag ( filename , options = { } ) filename = filename . to_s filename += '.js' unless filename . end_with? ( '.js' ) options [ :src ] = asset_url_for ( filename ) options [ :defer ] = :defer unless options . key? ( :defer ) options [ :async ] = :async unless options . key? ( :async ) ( tag ( :script , options , true ) . gsub ( / (?<attr>[a-z]+)= \" \k <attr> \" / , '\k<attr>' ) + '</script>' ) . html_safe end
Generates a SCRIPT tag for the given JS file.
Generates a SCRIPT tag for the given JS file .
# blah # add the extension, if not already present # set defer + async # return
filename
options