Sha256: e3d6fd44bb95722904d05f72b68bae24c0f836dd8ad19c1f30a5ab10d5193273
Contents?: true
Size: 958 Bytes
Versions: 3
Compression:
Stored size: 958 Bytes
Contents
require 'tilt' module Sprockets # Tilt engine class for the EJS compiler. Depends on the `ejs` gem. # # For more infomation see: # # https://github.com/sstephenson/ruby-ejs # class EjsTemplate < Tilt::Template # EJS templates always produced compiled JS. We can set Tilt's # default mime type hint. def self.default_mime_type 'application/javascript' end # Autoload ejs library. If the library isn't loaded, Tilt will produce # a thread safetly warning. If you intend to use `.ejs` files, you # should explicitly require it. def initialize_engine require_template_library 'ejs' end def prepare end # Compile template data with EJS compiler. # # Returns a JS function definition String. The result should be # assigned to a JS variable. # # # => "function(obj){...}" # def evaluate(scope, locals, &block) EJS.compile(data) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bpm-0.1.4 | vendor/sprockets/lib/sprockets/ejs_template.rb |
bpm-0.1.3 | vendor/sprockets/lib/sprockets/ejs_template.rb |
bpm-0.1.2 | vendor/sprockets/lib/sprockets/ejs_template.rb |