Class: Handlebars::Tilt
- Inherits:
-
Tilt::Template
- Object
- Tilt::Template
- Handlebars::Tilt
- Defined in:
- lib/handlebars-rails/tilt.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.default_mime_type ⇒ Object
6 7 8 |
# File 'lib/handlebars-rails/tilt.rb', line 6 def self.default_mime_type 'application/javascript' end |
Instance Method Details
#evaluate(scope, locals, &block) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/handlebars-rails/tilt.rb', line 14 def evaluate(scope, locals, &block) source = Barber::InlinePrecompiler.call data is_partial = File.basename(scope.logical_path).start_with?('_') template_name = scope.logical_path.sub(%r~^templates/~, "") template_name.gsub!(%r~/_~, '/') if is_partial target = is_partial ? "partials" : "templates" "if (!Handlebars.templates) Handlebars.templates = {};Handlebars.#{target}['#{template_name}']=#{source}" end |
#prepare ⇒ Object
10 11 12 |
# File 'lib/handlebars-rails/tilt.rb', line 10 def prepare end |