Sha256: ffd8a123e9d8f95fea9e27f0586acec4db5d92ce9e4c9a7a79057378b4c39f4f
Contents?: true
Size: 626 Bytes
Versions: 1
Compression:
Stored size: 626 Bytes
Contents
require 'typescript/rails/compiler' class TypeScript::Rails::TemplateHandler class << self def erb_handler @erb_handler ||= ActionView::Template.registered_template_handler(:erb) end def call(template) compiled_source = erb_handler.call(template) path = template.identifier.gsub(/['\\]/, '\\\\\&') # "'" => "\\'", '\\' => '\\\\' <<-EOS ::TypeScript::Rails::Compiler.compile('#{path}', (begin;#{compiled_source};end)) EOS end end end ActiveSupport.on_load(:action_view) do ActionView::Template.register_template_handler :ts, TypeScript::Rails::TemplateHandler end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ts-rails-0.0.1 | lib/typescript/rails/template_handler.rb |