Skip to content

Commit 4ff61bc

Browse files
authored
Added documentation for babel transform plugin
First time users who don't understand the structure of the gem have no way of knowing how to add transform plugins, or what version of babel react-rails is using to use the correct syntax
1 parent 99bb21a commit 4ff61bc

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,18 @@ Components must be accessible from the top level, but they may be namespaced, fo
199199

200200
`react-rails` provides two transformers, `React::JSX::BabelTransformer` (which uses [ruby-babel-transpiler](https://github.com/babel/ruby-babel-transpiler)) and `React::JSX::JSXTransformer` (which uses the deprecated `JSXTransformer.js`).
201201

202+
#### Transform Plugin Options
203+
204+
To supply additional transform plugins to your JSX Transformer, assign them to `config.react.jsx_transform_options`
205+
206+
`react-rails` uses the Babel version of the `babel-source` gem.
207+
208+
For example, to use `babel-plugin-transform-class-properties` :
209+
210+
config.react.jsx_transform_options = {
211+
optional: ['es7.classProperties']
212+
}
213+
202214
### React.js versions
203215

204216
`//= require react` brings `React` into your project.

0 commit comments

Comments
 (0)