Class: Sprockets::HandlebarsProcessor

Inherits:
Tilt::Template
  • Object
show all
Includes:
ActionView::Helpers::JavaScriptHelper
Defined in:
lib/sc-rails/handlebars_processor.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.default_mime_typeObject



10
11
12
# File 'lib/sc-rails/handlebars_processor.rb', line 10

def self.default_mime_type
  'application/javascript'
end

Instance Method Details

#evaluate(scope, locals, &block) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/sc-rails/handlebars_processor.rb', line 17

def evaluate(scope, locals, &block)
  name = scope.logical_path.downcase.gsub(/[^a-z0-9]/, '_')
  template = escape_javascript data
  "SC.TEMPLATES[\"\#{name}\"] = Handlebars.compile(\"\#{template}\");\n"
end

#prepareObject



14
15
# File 'lib/sc-rails/handlebars_processor.rb', line 14

def prepare
end