gem 'typescript-node'
Thanks to Jan Thomä for adding this one.
If you need to add a new tilt handler to awestruct, it’s quite simple. Here are the list of instructions:
Add any gems to your Gemfile
gem 'typescript-node'
Create the tilt handler
require 'tilt/template'
require 'typescript-node'
module Tilt
class TypeScriptTemplate < Template
self.default_mime_type = 'application/javascript'
def prepare
options[:filename] ||= file
end
def evaluate(scope, locals, &block)
@output ||= TypeScript::Node.compile(data, '--target', 'ES5')
end
end
end
Add the template via pipeline.rb
require 'typescript'
::Tilt::register ::Tilt::TypeScriptTemplate, 'ts'