|
9 | 9 | # react-rails
|
10 | 10 |
|
11 | 11 |
|
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) |
13 | 13 | in your Ruby on Rails (3.2+) application. `react-rails` can:
|
14 | 14 |
|
15 | 15 | - 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
|
82 | 82 | After installing `react-rails`, restart your server. Now, `.js.jsx` files will be transformed in the asset pipeline.
|
83 | 83 |
|
84 | 84 | `react-rails` currently ships with two transformers, to convert jsx code -
|
85 |
| - |
| 85 | + |
86 | 86 | * `BabelTransformer` using [Babel](http://babeljs.io), which is the default transformer.
|
87 | 87 | * `JSXTransformer` using `JSXTransformer.js`
|
88 | 88 |
|
| 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 | + |
89 | 95 | #### BabelTransformer options
|
90 | 96 |
|
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/), |
92 | 98 | and pass [options](http://babeljs.io/docs/usage/options/) to the babel transpiler adding following configurations:
|
93 | 99 |
|
94 | 100 | ```ruby
|
95 | 101 | config.react.jsx_transform_options = {
|
96 | 102 | blacklist: ['spec.functionName', 'validation.react'], # default options
|
97 | 103 | optional: ["transformerName"], # pass extra babel options
|
98 |
| - whitelist: ["useStrict"] # even more options |
| 104 | + whitelist: ["useStrict"] # even more options |
99 | 105 | }
|
100 | 106 | ```
|
101 | 107 | Under the hood, `react-rails` uses [ruby-babel-transpiler](https://github.com/babel/ruby-babel-transpiler), for transformation.
|
102 |
| - |
103 |
| -#### JSXTransformer options |
104 | 108 |
|
105 |
| -To use old JSXTransformer you can use `React::JSX.transformer_class = React::JSX::JSXTransformer` |
| 109 | +#### JSXTransformer options |
106 | 110 |
|
107 | 111 | You can use JSX `--harmony` or `--strip-types` options by adding a configuration:
|
108 | 112 |
|
|
0 commit comments