Skip to content

Commit 9ce5ac4

Browse files
committed
docs(readme) fix config for jsx transformer class
1 parent d919099 commit 9ce5ac4

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# react-rails
1010

1111

12-
`react-rails` makes it easy to use [React](http://facebook.github.io/react/) and [JSX](http://facebook.github.io/react/docs/jsx-in-depth.html)
12+
`react-rails` makes it easy to use [React](http://facebook.github.io/react/) and [JSX](http://facebook.github.io/react/docs/jsx-in-depth.html)
1313
in your Ruby on Rails (3.2+) application. `react-rails` can:
1414

1515
- Provide [various `react` builds](#reactjs-builds) to your asset bundle
@@ -82,27 +82,31 @@ See [VERSIONS.md](https://github.com/reactjs/react-rails/blob/master/VERSIONS.md
8282
After installing `react-rails`, restart your server. Now, `.js.jsx` files will be transformed in the asset pipeline.
8383

8484
`react-rails` currently ships with two transformers, to convert jsx code -
85-
85+
8686
* `BabelTransformer` using [Babel](http://babeljs.io), which is the default transformer.
8787
* `JSXTransformer` using `JSXTransformer.js`
8888

89+
You can use the deprecated `JSXTransformer` by setting it in an application config:
90+
91+
```ruby
92+
config.react.jsx_transformer_class = React::JSX::JSXTransformer
93+
```
94+
8995
#### BabelTransformer options
9096

91-
You can use babel's [transformers](http://babeljs.io/docs/advanced/transformers/) and [custom plugins](http://babeljs.io/docs/advanced/plugins/),
97+
You can use babel's [transformers](http://babeljs.io/docs/advanced/transformers/) and [custom plugins](http://babeljs.io/docs/advanced/plugins/),
9298
and pass [options](http://babeljs.io/docs/usage/options/) to the babel transpiler adding following configurations:
9399

94100
```ruby
95101
config.react.jsx_transform_options = {
96102
blacklist: ['spec.functionName', 'validation.react'], # default options
97103
optional: ["transformerName"], # pass extra babel options
98-
whitelist: ["useStrict"] # even more options
104+
whitelist: ["useStrict"] # even more options
99105
}
100106
```
101107
Under the hood, `react-rails` uses [ruby-babel-transpiler](https://github.com/babel/ruby-babel-transpiler), for transformation.
102-
103-
#### JSXTransformer options
104108

105-
To use old JSXTransformer you can use `React::JSX.transformer_class = React::JSX::JSXTransformer`
109+
#### JSXTransformer options
106110

107111
You can use JSX `--harmony` or `--strip-types` options by adding a configuration:
108112

0 commit comments

Comments
 (0)