Module: Sprockets::Rails::LegacyAssetTagHelper

Includes:
ActionView::Helpers::TagHelper
Included in:
Helper
Defined in:
lib/sprockets/rails/legacy_asset_tag_helper.rb

Overview

Backports of AssetTagHelper methods for Rails 2.x and 3.x.

Instance Method Summary collapse

Instance Method Details

#javascript_include_tag(*sources) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/sprockets/rails/legacy_asset_tag_helper.rb', line 9

def javascript_include_tag(*sources)
  options = sources.extract_options!.stringify_keys
  sources.uniq.map { |source|
    tag_options = {
      "src" => path_to_javascript(source)
    }.merge(options)
    (:script, "", tag_options)
  }.join("\n").html_safe
end


19
20
21
22
23
24
25
26
27
28
29
# File 'lib/sprockets/rails/legacy_asset_tag_helper.rb', line 19

def stylesheet_link_tag(*sources)
  options = sources.extract_options!.stringify_keys
  sources.uniq.map { |source|
    tag_options = {
      "rel" => "stylesheet",
      "media" => "screen",
      "href" => path_to_stylesheet(source)
    }.merge(options)
    tag(:link, tag_options)
  }.join("\n").html_safe
end