module Sprockets::EjsTemplate

Processor engine class for the EJS compiler. Depends on the `ejs` gem.

For more infomation see:

https://github.com/sstephenson/ruby-ejs

Constants

VERSION

Public Class Methods

cache_key() click to toggle source
# File lib/sprockets/ejs_processor.rb, line 13
def self.cache_key
  @cache_key ||= "#{name}:#{VERSION}".freeze
end
call(input) click to toggle source

Compile template data with EJS compiler.

Returns a JS function definition String. The result should be assigned to a JS variable.

# => "function(obj){...}"
# File lib/sprockets/ejs_processor.rb, line 24
def self.call(input)
  data = input[:data]
  input[:cache].fetch([cache_key, data]) do
    Autoload::EJS.compile(data)
  end
end