Class: Sprockets::Emblem
- Inherits:
-
Tilt::Template
- Object
- Tilt::Template
- Sprockets::Emblem
- Defined in:
- lib/sprockets/emblem.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.default_mime_type ⇒ Object
10 11 12 |
# File 'lib/sprockets/emblem.rb', line 10 def self.default_mime_type 'application/javascript' end |
Instance Method Details
#context ⇒ Object
14 15 16 |
# File 'lib/sprockets/emblem.rb', line 14 def context @context ||= ExecJS.compile('var window={};' + hbs_source + emblem_source + ';var Emblem = window.Emblem;') end |
#evaluate(scope, locals, &block) ⇒ Object
18 19 20 21 |
# File 'lib/sprockets/emblem.rb', line 18 def evaluate(scope, locals, &block) compiled_hbs = context.call('Emblem.precompile', hbs_variant, data) "Handlebars.template(#{compiled_hbs});" end |