Skip to content

Instantly share code, notes, and snippets.

@ncri
Created Sep 23, 2012
Embed
What would you like to do?
module Coffee
module Rails
class HamlTemplateHandler
def self.haml_handler
@@haml_handler ||= ActionView::Template.registered_template_handler(:haml)
end
def self.call(template)
compiled_source = haml_handler.call(template)
"CoffeeScript.compile(begin;#{compiled_source};end)"
end
end
end
end
ActiveSupport.on_load(:action_view) do
ActionView::Template.register_template_handler :coffee_haml, Coffee::Rails::HamlTemplateHandler
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment