Method: Helper::Helper#script

Defined in:
lib/helper/helper.rb

#script(*args) ⇒ String

TODO:

because those js-files are all relative links, they could be joined together and packed afterwards

Creates a javascript-tag for each input string to import the script. The resource will be linked relativly.

Examples:

script 'foo', 'bar'
#=> <script href='../js/foo.js'/>
#=> <script href='../js/bar.js'/>

Parameters:

  • basename (String)

    of the javascript-file (without extension)

Returns:

  • (String)

    html-element to include the javascript-file



85
86
87
88
89
# File 'lib/helper/helper.rb', line 85

def script(*args)
  args.map do |path|
    tag :script, "", :src => to_relative('js/'+path+'.js')
  end.join ''
end