Module: Assette::ViewHelper::Production
- Defined in:
- lib/assette/view_helper.rb
Constant Summary collapse
- ASSET_TAGS =
Hash.new
Instance Method Summary collapse
- #__asset_tag(file) ⇒ Object
-
#asset_tag(file) ⇒ Object
Store the path name for each asset so to speed up things a little and to make sure it’s alwasy getting the smae host.
Instance Method Details
#__asset_tag(file) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/assette/view_helper.rb', line 31 def __asset_tag file ex = file.match(/\.(\w+)$/) if ex && target_class = Assette::Reader.target_class(ex[1]) @__asset_iterator ||= -1 # Conerns about whether this will get re_instantiated on each request must investigate file.gsub!(/\.(\w+)$/) do |s| ".#{Assette::Reader::OUTPUT_MAP[$1]}" end url = Assette.compiled_path @__asset_iterator+=1, file target_class.tag url else <<-HTML <!-- Can't find file or reader for #{file.inspect}--> HTML end end |
#asset_tag(file) ⇒ Object
Store the path name for each asset so to speed up things a little and to make sure it’s alwasy getting the smae host
27 28 29 |
# File 'lib/assette/view_helper.rb', line 27 def asset_tag file ASSET_TAGS[file] ||= __asset_tag(file) end |