File: typescript.rb

package info (click to toggle)
ruby-tilt 2.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 632 kB
  • sloc: ruby: 4,975; makefile: 7
file content (24 lines) | stat: -rw-r--r-- 456 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

# = Typescript
#
# TypeScript implementation.

require_relative 'template'
require 'typescript-node'

Tilt::TypeScriptTemplate = Tilt::StaticTemplate.subclass(mime_type: 'application/javascript') do
  option_args = []

  @options.each do |key, value|
    next unless value

    option_args << "--#{key}"

    if value != true
      option_args << value.to_s
    end
  end

  TypeScript::Node.compile(@data, *option_args)
end