|
1 | | -# react-rails [](https://travis-ci.org/facebook/react-rails) [](https://codeclimate.com/github/facebook/react-rails) |
| 1 | +# react-rails [](https://travis-ci.org/reactjs/react-rails) [](https://codeclimate.com/github/reactjs/react-rails) |
2 | 2 |
|
3 | 3 | react-rails is a ruby gem which makes it easier to use [React](http://facebook.github.io/react/) and [JSX](http://facebook.github.io/react/docs/jsx-in-depth.html) in your Ruby on Rails application. |
4 | 4 |
|
|
107 | 107 |
|
108 | 108 | ### Add-ons |
109 | 109 |
|
110 | | -Beginning with React v0.5, there is another type of build. This build ships with some "add-ons" that might be useful - [take a look at the React documentation for details](http://facebook.github.io/react/docs/addons.html). In order to make these available, we've added another configuration (which defaults to `false`). |
111 | | - |
112 | | -```ruby |
113 | | -MyApp::Application.configure do |
114 | | - config.react.addons = true |
115 | | -end |
116 | | -``` |
117 | | - |
118 | | - |
119 | | -## CoffeeScript |
120 | | - |
121 | | -It is possible to use JSX with CoffeeScript. The caveat is that you will still need to include the docblock. Since CoffeeScript doesn't allow `/* */` style comments, we need to do something a little different. We also need to embed JSX inside backticks so CoffeeScript ignores the syntax it doesn't understand. Here's an example: |
122 | | - |
123 | | -```coffee |
124 | | -###* @jsx React.DOM ### |
125 | | - |
126 | | -Component = React.createClass |
127 | | - render: -> |
128 | | - `<ExampleComponent videos={this.props.videos} />` |
129 | | -``` |
130 | | - |
131 | | -### Changing react.js and JSXTransformer.js versions |
132 | | - |
133 | | -In some cases you may want to have your `react.js` and `JSXTransformer.js` files come from a different release than the one, that is specified in the `react-rails.gemspec`. To achieve that, you have to manually replace them in your app. |
134 | | - |
135 | | -#### Instructions |
136 | | - |
137 | | -Just put another version of `react.js` or `JSXTransformer.js` under `/vendor/assets/react` directory. |
138 | | -If you need different versions of `react.js` for production and development, then use a subdirectory named |
139 | | -after `config.react.variant`, e.g. you set `config.react.variant = :development` so for this environment |
140 | | -`react.js` is expected to be in `/vendor/assets/react/development` |
141 | | - |
142 | | -#### Things to remember |
143 | | - |
144 | | -If you replace `JSXTransformer.js` in production environment, you have to restart your rails instance, |
145 | | -because the jsx compiler context is cached. |
146 | | - |
147 | | -Name of the `JSXTransformer.js` file *is case-sensitive*. |
| 110 | +Beginning with React v0.5, there is another type of build. This build ships with some "add-ons" that might be useful - [take a look at the React documentation for details](http |
0 commit comments