Class: Jekyll::Converters::Babel
- Inherits:
-
Converter
- Object
- Converter
- Jekyll::Converters::Babel
- Defined in:
- lib/jekyll/converters/babel.rb
Constant Summary collapse
- DEFAULT_CONFIGURATION =
{ 'babel_js_extensions' => 'js, es6, babel, jsx' }
Instance Method Summary collapse
- #convert(content) ⇒ Object
-
#initialize(config = {}) ⇒ Babel
constructor
A new instance of Babel.
- #matches(ext) ⇒ Object
- #output_ext(ext) ⇒ Object
Constructor Details
#initialize(config = {}) ⇒ Babel
Returns a new instance of Babel.
11 12 13 |
# File 'lib/jekyll/converters/babel.rb', line 11 def initialize(config = {}) @config = Jekyll::Utils.deep_merge_hashes(DEFAULT_CONFIGURATION, config) end |
Instance Method Details
#convert(content) ⇒ Object
23 24 25 |
# File 'lib/jekyll/converters/babel.rb', line 23 def convert(content) ::Babel::Transpiler.transform(content)['code'] end |
#matches(ext) ⇒ Object
15 16 17 |
# File 'lib/jekyll/converters/babel.rb', line 15 def matches(ext) extname_list.include? ext.downcase end |
#output_ext(ext) ⇒ Object
19 20 21 |
# File 'lib/jekyll/converters/babel.rb', line 19 def output_ext(ext) ".js" end |