Created
December 21, 2010 15:10
-
-
Save stephencelis/750025 to your computer and use it in GitHub Desktop.
CoffeeScript template handler for Rails 3.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/action_view/template/handlers/coffee_script.rb | |
module ActionView | |
class Template | |
module Handlers | |
class CoffeeScript | |
def call template | |
::CoffeeScript.compile(template.source).inspect | |
end | |
end | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'coffee-script' | |
gem 'rails_assets', :git => 'git://github.com/wycats/rails_assets.git' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/template_handlers.rb | |
require 'action_view/template/handlers/coffee_script' | |
ActionView::Template.register_template_handler :coffee, | |
ActionView::Template::Handlers::CoffeeScript.new |
Typos are fun. Fixed, thanks :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Replace this:
with this: