module Assette::ViewHelper::Production

Constants

ASSET_TAGS

Public Instance Methods

__asset_tag(file) click to toggle source
# 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) click to toggle source

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

# File lib/assette/view_helper.rb, line 27
def asset_tag file
  ASSET_TAGS[file] ||= __asset_tag(file)
end