Sha256: 7c5ff03edbb7678e9b6e3d759be4a633065a373d2ed813ab650c9e26503ba63f

Contents?: true

Size: 620 Bytes

Versions: 6

Compression:

Stored size: 620 Bytes

Contents

require 'ejs'

module Sprockets
  # Template engine class for the EJS compiler. Depends on the `ejs` gem.
  #
  # For more infomation see:
  #
  #   https://github.com/sstephenson/ruby-ejs
  #
  module EjsTemplate
    VERSION = '1'

    # Compile template data with EJS compiler.
    #
    # Returns a JS function definition String. The result should be
    # assigned to a JS variable.
    #
    #     # => "function(obj){...}"
    #
    def self.call(input)
      data = input[:data]
      key  = ['EjsTemplate', VERSION, data]
      input[:cache].fetch(key) do
        ::EJS.compile(data)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sprockets-3.0.0.beta.6 lib/sprockets/ejs_template.rb
sprockets-3.0.0.beta.5 lib/sprockets/ejs_template.rb
sprockets-3.0.0.beta.4 lib/sprockets/ejs_template.rb
sprockets-3.0.0.beta.3 lib/sprockets/ejs_template.rb
sprockets-3.0.0.beta.2 lib/sprockets/ejs_template.rb
sprockets-3.0.0.beta.1 lib/sprockets/ejs_template.rb