Skip to content

Commit b269b16

Browse files
committed
update for replay_console config
1 parent 049c000 commit b269b16

File tree

1 file changed

+3
-40
lines changed

1 file changed

+3
-40
lines changed

README.md

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ MyApp::Application.configure do
172172
# array of filenames that will be requested from the asset pipeline
173173
# and concatenated:
174174
config.react.component_filenames = ['components.js']
175+
# server-side console.log, console.warn, and console.error messages will be replayed on the client
176+
# (you can set this to `true` in config/enviroments/development.rb to replay in development only)
177+
config.react.replay_console = false
175178
end
176179
```
177180

@@ -248,27 +251,6 @@ json.messages(@messages) do |message|
248251
end
249252
```
250253

251-
### Server Rendering
252-
253-
For performance and thread-safety reasons, a pool of JS VMs are spun up on application start, and the size of the pool and the timeout on requesting a VM from the pool are configurable.
254-
255-
```ruby
256-
# config/environments/application.rb
257-
# These are the defaults if you dont specify any yourself
258-
MyApp::Application.configure do
259-
config.react.max_renderers = 10
260-
config.react.timeout = 20 #seconds
261-
config.react.react_js = lambda {File.read(::Rails.application.assets.resolve('react.js'))}
262-
config.react.component_filenames = ['components.js']
263-
config.react.replay_console = false
264-
end
265-
```
266-
267-
Other configuration options include:
268-
* `react_js`: where you want to grab the javascript library from
269-
* `component_filenames`: an array of filenames that will be requested from the asset pipeline and concatenated together
270-
* `replay_console`: additional debugging by replaying any captured console messages from server-rendering back on the client (note: they will lose their call stack, but it can help point you in right direction)
271-
272254
## CoffeeScript
273255

274256
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:
@@ -278,22 +260,3 @@ Component = React.createClass
278260
render: ->
279261
`<ExampleComponent videos={this.props.videos} />`
280262
```
281-
282-
### Changing react.js and JSXTransformer.js versions
283-
284-
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.
285-
286-
#### Instructions
287-
288-
Just put another version of `react.js` or `JSXTransformer.js` under `/vendor/assets/react` directory.
289-
If you need different versions of `react.js` for production and development, then use a subdirectory named
290-
after `config.react.variant`, e.g. you set `config.react.variant = :development` so for this environment
291-
`react.js` is expected to be in `/vendor/assets/react/development`
292-
293-
#### Things to remember
294-
295-
If you replace `JSXTransformer.js` in production environment, you have to restart your rails instance,
296-
because the jsx compiler context is cached.
297-
298-
Name of the `JSXTransformer.js` file *is case-sensitive*.
299-

0 commit comments

Comments
 (0)