You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-20
Original file line number
Diff line number
Diff line change
@@ -16,9 +16,9 @@ By Justin Gordon and the Shaka Code Team, [www.shakacode.com](http://www.shakaco
16
16
- Feel free to open discussions at [forum.shakacode.com](http://forum.shakacode.com). We love to help!
17
17
- We now have a [gitter chat room for this topic](https://gitter.im/shakacode/react-webpack-rails-tutorial) but we prefer our Slack Channel ([email us](mailto:[email protected]) for an invite).
18
18
- Check out the [react_on_rails gem](https://github.com/shakacode/react_on_rails) for easy webpack integration.
19
-
- If you came to here from the blog article, this example project has evolved. See [pull requests](https://github.com/shakacode/react-webpack-rails-tutorial/pulls?utf8=%E2%9C%93&q=is%3Apr).
19
+
- If you came to here from the blog article, this example project has evolved. See [merged pull requests](https://github.com/shakacode/react-webpack-rails-tutorial/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Amerged) and the [CHANGELOG.md](./CHANGELOG.md).
20
20
21
-
A Full tutorial article can be found at: [Fast Rich Client Rails Development With Webpack and the ES6 Transpiler](http://www.railsonmaui.com/blog/2014/10/03/integrating-webpack-and-the-es6-transpiler-into-an-existing-rails-project/). Note, this source code repository is way ahead of the tutorial. We plan to update the tutorial article as soon as we can catch our breath!
21
+
An outdated full tutorial article behind of the motivation of this system can be found at: [Fast Rich Client Rails Development With Webpack and the ES6 Transpiler](http://www.railsonmaui.com/blog/2014/10/03/integrating-webpack-and-the-es6-transpiler-into-an-existing-rails-project/). Note, this source code repository is way ahead of the tutorial.
22
22
23
23
# NEWS
24
24
We have not yet updated the `react_on_rails` gem generators for the following tasks. We're looking for help to migrate this, if you're interested in contributing to the project. *The tutorial* refers to this repo. The following changes have resulted in lots of differences for the webpack files and visual assets:
@@ -28,7 +28,6 @@ We have not yet updated the `react_on_rails` gem generators for the following ta
28
28
29
29
If you did generate a fresh app from React On Rails and want to move to CSS Modules, then see [PR 175: Babel 6 / CSS Modules / Rails hot reloading](https://github.com/shakacode/react-webpack-rails-tutorial/pull/175). Note, while there are probably fixes after this PR was accepted, this has the majority of the changes.
30
30
31
-
32
31
# Example Application
33
32
This is a simple example application that illustrates the use of ReactJs to implement a commenting system. Front-end code leverages both ReactJs and Rails asset pipeline while the backend is 100% Rails. It shows off a little bit of the interactivity of a ReactJs application, allowing the commmenter to choose the form layout. `react-bootstrap` is used for the React components. A pure Rails UI generated from scaffolding is shown for comparison.
34
33
@@ -40,7 +39,7 @@ In no particular order:
40
39
41
40
- Example of using the [react_on_rails gem](https://github.com/shakacode/react_on_rails) for easy react/webpack integration with Rails.
42
41
- Example of React with [CSS Modules](http://glenmaddern.com/articles/css-modules) inside of Rails using Webpack as described in [Smarter CSS builds with Webpack](http://bensmithett.com/smarter-css-builds-with-webpack/).
43
-
- Example of enabling hot reloading of both JS and CSS from your Rails app in development mode. Change your code. Save. Browser updates without a refresh!
42
+
- Example of enabling hot reloading of both JS and CSS (modules) from your Rails app in development mode. Change your code. Save. Browser updates without a refresh!
44
43
- Example of Rails 4.2 with ReactJs/Redux/React-Router with Webpack and ES7.
45
44
- Enabling development of a JS client independently from Rails using the [Webpack Dev Server](https://webpack.github.io/docs/webpack-dev-server.html). You can see this by starting the app and visiting http://localhost:4000
46
45
- Enabling the use of npm modules and [Babel](https://babeljs.io/) with a Rails application using [Webpack](https://webpack.github.io/).
@@ -74,15 +73,23 @@ See package.json and Gemfile for versions
74
73
1.`bundle install`
75
74
1.`npm install`
76
75
1.`rake db:setup`
77
-
1.`foreman start -f Procfile.dev`
78
-
1. Open a browser tab to http://localhost:3000 for the Rails app example.
79
-
1. Open a browser tab to http://localhost:4000 for the Hot Module Replacement Example.
76
+
1.`foreman start -f Procfile.hot`
77
+
1. Open a browser tab to http://localhost:3000 for the Rails app example with HOT RELOADING
78
+
2. Try Hot Reloading steps below!
79
+
1.`foreman start -f Procfile.express`
80
+
1. Open a browser tab to http://localhost:4000 for the Hot Module Replacement Example just using an express server (no Rails involved). This is good for fast prototyping of React components. However, this setup is not as useful now that we have hot reloading working for Rails!
81
+
2. Try Hot Reloading steps below!
82
+
1.`foreman start -f Procfile.static`
83
+
1. Open a browser tab to http://localhost:3000 for the Rails app example.
84
+
2. When you make changes, you have to refresh the browser page.
85
+
86
+
## Hot Reloading Example (applies to both `Procfile.hot` and `Procfile.express`.
80
87
1. With the browser open to any JSX file, such as [client/app/bundles/comments/components/CommentBox/CommentBox.jsx](client/app/bundles/comments/components/CommentBox/CommentBox.jsx) and you can change the JSX code, hit save, and you will see the sceen update without refreshing the window. This applies to port 3000 and port 4000.
81
88
1. Try changing a `.scss` file, such as a color in [client/app/bundles/comments/components/CommentBox/CommentList/Comment/Comment.scss](client/app/bundles/comments/components/CommentBox/CommentList/Comment/Comment.scss). You can see port 3000 or 4000 update automatically.
82
89
1. Be sure to take a look at the different Procfiles in this directory, as described below.
83
90
84
91
# KEY COMMANDS
85
-
1. Run all linters and tests: `rake ci`
92
+
1. Run all linters and tests: `rake`
86
93
1. See all npm commands: `npm run`
87
94
1. Start all development processes: `foreman start -f Procfile.dev`
88
95
1. Start all Rails only development processes: `foreman start -f Procfile.rails`
In genereral, you want to avoid running more webpack watch processes than you need. The `Procfile.dev`, for example, runs both the express server (Webpack dev server) and the Rails hot assets reloading server.
170
177
171
178
## Contributors
172
-
[The Shaka Code team!](http://www.shakacode.com/about/) and many others!
173
-
174
-
Notable contributions include (please submit PR if I miss any!):
175
-
176
-
*[Justin Gordon](https://github.com/justin808/): Started this, leads this
177
-
*[Alex Fedoseev](https://github.com/alexfedoseev): Added integration of Rails hot loading and CSS modules, plus much more
178
-
*[Martin Breining](https://github.com/mbreining): For adding flux at first
179
-
*[Dylan Grafmyre](https://github.com/Dgrafmyre): For ci setup
180
-
*[Rob Wise](https://github.com/robwise): Many doc improvements
181
-
*[Josias Schneider](https://github.com/josiasd): Conversion to the new react_on_rails format
182
-
183
-
See the full list of [Contributors](https://github.com/shakacode/react-webpack-rails-tutorial/graphs/contributors)
179
+
[The Shaka Code team!](http://www.shakacode.com/about/), led by [Justin Gordon](https://github.com/justin808/), along with with many others. See [contributors.md](docs/contributors.md)
184
180
185
181
# Open Code of Conduct
186
182
This project adheres to the [Open Code of Conduct](http://todogroup.org/opencodeofconduct/#fetch/[email protected]). By participating, you are expected to uphold this code.
0 commit comments