From 4ff61bcac1e0baa7941860803f703df642d22481 Mon Sep 17 00:00:00 2001 From: Gerard Simpson Date: Mon, 13 Aug 2018 13:49:36 +1000 Subject: [PATCH] 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 --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 0f26d9f06..e467756b4 100644 --- a/README.md +++ b/README.md @@ -199,6 +199,18 @@ Components must be accessible from the top level, but they may be namespaced, fo `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`). +#### Transform Plugin Options + +To supply additional transform plugins to your JSX Transformer, assign them to `config.react.jsx_transform_options` + +`react-rails` uses the Babel version of the `babel-source` gem. + +For example, to use `babel-plugin-transform-class-properties` : + + config.react.jsx_transform_options = { + optional: ['es7.classProperties'] + } + ### React.js versions `//= require react` brings `React` into your project.