Skip to content

Instantly share code, notes, and snippets.

@sunaku
Forked from kamk/Rails template helper for Ember
Created April 5, 2010 01:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sunaku/355887 to your computer and use it in GitHub Desktop.
Save sunaku/355887 to your computer and use it in GitHub Desktop.
require 'ember'
module ActionView
module TemplateHandlers
##
# @example Pass template processing options to Ember
#
# ActionView::TemplateHandlers::Ember.options = {
# :unindent => true,
# :shorthand => true,
# :infer_end => true
# }
#
class Ember < TemplateHandler
@@options = {}
cattr_accessor :options
include Compilable
def compile(template)
options = @@options.merge(:source_file => template.filename)
::Ember::Template.new(template.source, options).program
end
end
end
ember_handler = TemplateHandlers::Ember
Template.register_default_template_handler :erb, ember_handler
Template.register_template_handler :rhtml, ember_handler
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment