Instantly share code, notes, and snippets.

Embed
What would you like to do?
ember_handlebars.rb
require 'tilt'
require 'json'
class EmberHandlebars < Tilt::Template
def self.default_mime_type
"application/javascript"
end
def prepare
end
def evaluate(scope, locals, &block)
"Ember.TEMPLATES['#{scope.logical_path}'] = Ember.Handlebars.compile(#{data.to_json})"
end
end
# Rails
Rails.application.assets.engines['handlebars'] = HandlebarsTemplate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment