Sha256: 0b876d2dcfcfa16a17d40d5dce402c7e9b2833336b032b380de669322d453afe

Contents?: true

Size: 479 Bytes

Versions: 35

Compression:

Stored size: 479 Bytes

Contents

module Coffee
  module Rails
    class TemplateHandler
      def self.erb_handler
        @@erb_handler ||= ActionView::Template.registered_template_handler(:erb)
      end

      def self.call(template)
        compiled_source = erb_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, Coffee::Rails::TemplateHandler
end

Version data entries

35 entries across 34 versions & 8 rubygems

Version Path
active_mailer-0.0.4 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/coffee-rails-3.2.2/lib/coffee/rails/template_handler.rb
active_mailer-0.0.3 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/coffee-rails-3.2.2/lib/coffee/rails/template_handler.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/coffee-rails-3.2.2/lib/coffee/rails/template_handler.rb
coffee-redux-rails-4.0.0.beta lib/coffee/rails/template_handler.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/coffee-rails-3.2.2/lib/coffee/rails/template_handler.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/coffee-rails-3.2.2/lib/coffee/rails/template_handler.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/coffee-rails-3.2.2/lib/coffee/rails/template_handler.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/coffee-rails-3.2.2/lib/coffee/rails/template_handler.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/coffee-rails-3.2.2/lib/coffee/rails/template_handler.rb
coffee-rails-3.2.2 lib/coffee/rails/template_handler.rb
coffee-rails-3.2.1 lib/coffee/rails/template_handler.rb
coffee-rails-3.2.0 lib/coffee/rails/template_handler.rb
coffee-rails-3.1.1 lib/coffee/rails/template_handler.rb
coffee-rails-3.1.0 lib/coffee/rails/template_handler.rb
coffee-rails-3.1.0.rc.7 lib/coffee/rails/template_handler.rb