Module: ActionView::Helpers::AssetTagHelper

Defined in:
lib/html_import_tag/helpers/asset_tag_helper.rb

Instance Method Summary collapse

Instance Method Details

#html_import_tag(*sources) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/html_import_tag/helpers/asset_tag_helper.rb', line 4

def html_import_tag(*sources)
  options = sources.extract_options!.stringify_keys
  path_options = options.extract!('protocol', 'extname').symbolize_keys

  sources.uniq.map do |source|
    tag_options = {
      rel: "import",
      href: path_to_asset(source, {:type => :html, extname: ".html"}.merge!(path_options))
    }.merge!(options)

    tag(:link, tag_options)

  end.join("\n").html_safe
end