Sha256: ae4a832a5425259f7c15bf1cf094f5d463afdf648d3786710c8fd0a893ac9c58

Contents?: true

Size: 492 Bytes

Versions: 2

Compression:

Stored size: 492 Bytes

Contents

require 'tilt'

module HoganAssets
  class Tilt < Tilt::Template
    self.default_mime_type = 'application/javascript'

    def evaluate(scope, locals, &block)
      compiled_template = Hogan.compile(data)
      template_name = scope.logical_path.inspect
      <<-TEMPLATE
        this.HoganTemplates || (this.HoganTemplates = {});
        this.HoganTemplates[#{template_name}] = new Hogan.Template(#{compiled_template});
      TEMPLATE
    end

    protected

    def prepare; end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hogan_assets-1.0.3 lib/hogan_assets/tilt.rb
hogan_assets-1.0.2 lib/hogan_assets/tilt.rb