Module: React::JSX

Defined in:
lib/react/jsx.rb,
lib/react/jsx/template.rb,
lib/react/jsx/processor.rb,
lib/react/jsx/jsx_transformer.rb,
lib/react/jsx/babel_transformer.rb,
lib/react/jsx/sprockets_strategy.rb

Defined Under Namespace

Modules: SprocketsStrategy Classes: BabelTransformer, JSXTransformer, Processor, Template

Constant Summary collapse

DEFAULT_TRANSFORMER =
BabelTransformer

Class Method Summary collapse

Class Method Details

.transform(code) ⇒ String

Returns plain, browser-ready JavaScript code

Parameters:

  • code (String)

    JSX code to transform into JavaScript

Returns:

  • (String)

    plain, browser-ready JavaScript code


22
23
24
25
# File 'lib/react/jsx.rb', line 22

def self.transform(code)
  self.transformer ||= transformer_class.new(transform_options)
  self.transformer.transform(code)
end