Module: Assette::ViewHelper::Development

Defined in:
lib/assette/view_helper.rb

Instance Method Summary collapse

Instance Method Details

#asset_tag(file) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/assette/view_helper.rb', line 5

def asset_tag file
  output = ["<!-- Assets for #{file} -->"]
  real_path = Assette.config.find_file_from_relative_path(file)
  f = Assette::File.open(real_path)
  
  output << Assette::Reader::Js.tag("/__templates/#{f.templates.join(':')}") unless f.templates.empty?
  
  f.dependencies.each do |d|
    output << d.dev_tag
  end
  output << f.dev_tag
  
  output << "<!-- END #{file} -->"
  
  output.join("\n")
end