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
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/coffee-rails-4.2.1/lib/coffee/rails/template_handler.rb
coffee-rails-4.2.1 lib/coffee/rails/template_handler.rb
coffee-rails-4.2.0 lib/coffee/rails/template_handler.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/coffee-rails-4.1.1/lib/coffee/rails/template_handler.rb
coffee-rails-4.1.1 lib/coffee/rails/template_handler.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/coffee-rails-4.1.0/lib/coffee/rails/template_handler.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/coffee-rails-4.1.0/lib/coffee/rails/template_handler.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/coffee-rails-4.1.0/lib/coffee/rails/template_handler.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/coffee-rails-4.0.1/lib/coffee/rails/template_handler.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/coffee-rails-4.1.0/lib/coffee/rails/template_handler.rb
active_mailer-0.0.10 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/coffee-rails-3.2.2/lib/coffee/rails/template_handler.rb
coffee-rails-4.1.0 lib/coffee/rails/template_handler.rb
coffee-rails-4.0.1 lib/coffee/rails/template_handler.rb
active_mailer-0.0.9 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.8 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.7 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.6 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/coffee-rails-3.2.2/lib/coffee/rails/template_handler.rb
coffee-rails-4.0.0 lib/coffee/rails/template_handler.rb
coffee-rails-4.0.0.beta1 lib/coffee/rails/template_handler.rb
active_mailer-0.0.5 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/coffee-rails-3.2.2/lib/coffee/rails/template_handler.rb