Class: Sprockets::DotJS::Compiler
- Inherits:
-
Tilt::Template
- Object
- Tilt::Template
- Sprockets::DotJS::Compiler
- Defined in:
- lib/sprockets/dotjs/compiler.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.default_mime_type ⇒ Object
8 9 10 |
# File 'lib/sprockets/dotjs/compiler.rb', line 8 def self.default_mime_type 'application/javascript' end |
Instance Method Details
#prepare ⇒ Object
12 13 |
# File 'lib/sprockets/dotjs/compiler.rb', line 12 def prepare end |
#render(scope, locals, &block) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/sprockets/dotjs/compiler.rb', line 15 def render(scope, locals, &block) dotjs_lib = open(::File.join(::File.dirname(__FILE__), '..', '..', 'support', 'doT.js')).read context = ExecJS.compile(dotjs_lib) context.eval("doT.template(#{data.inspect}, undefined, undefined).toString()") end |