File: babel.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 (13 lines) | stat: -rw-r--r-- 275 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
# frozen_string_literal: true

# = Babel
#
#

require_relative 'template'
require 'babel/transpiler'

Tilt::BabelTemplate = Tilt::StaticTemplate.subclass(mime_type: 'application/javascript') do
  @options[:filename] ||= @file
  Babel::Transpiler.transform(@data)["code"]
end