Skip to content

Pick-and-choose addons with Sprockets directives #457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@

#### New Features

- Individual add-ons can be included in a bundle with sprockets require directives.

#### Deprecation

#### Bug Fixes

- Add CHANGELOG to gem bundle #471
- Add CHANGELOG to gem bundle #471
- Use `window.attachEvent` to support IE8 without jQuery 😬#446

## 1.5.0 (November 25, 2015)
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ end
After restarting your Rails server, `//= require react` will provide the build of React.js which
was specified by the configurations.

If you want to hand-pick which add-ons are added to your build they are available via sprockets
directives.

```js
//= require react
//= require react-addons-css-transition-group
```

`react-rails` offers a few other options for versions & builds of React.js.
See [VERSIONS.md](https://github.com/reactjs/react-rails/blob/master/VERSIONS.md) for more info about
using the `react-source` gem or dropping in your own copies of React.js.
Expand Down
17 changes: 17 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,26 @@ namespace :react do
# Without addons:
copy_react_asset("#{environment}/react-browser.js", "#{environment}/react.js")
copy_react_asset("#{environment}/react-server.js", "#{environment}/react-server.js")

# With addons:
copy_react_asset("#{environment}/react-browser-with-addons.js", "#{environment}-with-addons/react.js")
copy_react_asset("#{environment}/react-server-with-addons.js", "#{environment}-with-addons/react-server.js")

addons = %w(
addons-clone-with-props
addons-create-fragment
addons-css-transition-group
addons-linked-state-mixin
addons-perf
addons-pure-render-mixin
addons-test-utils
addons-transition-group
addons-update
)

addons.each do |name|
copy_react_asset("#{environment}/react-#{name}.js", "#{environment}/react-#{name}.js")
end
end
end

Expand Down
Loading