Skip to content

Commit e445a7a

Browse files
committed
temp PR -- I will close this PR
1 parent 3e1f722 commit e445a7a

File tree

1 file changed

+1
-229
lines changed

1 file changed

+1
-229
lines changed

README.md

Lines changed: 1 addition & 229 deletions
Original file line numberDiff line numberDiff line change
@@ -1,229 +1 @@
1-
[![Code Climate](https://codeclimate.com/github/shakacode/react-webpack-rails-tutorial/badges/gpa.svg)](https://codeclimate.com/github/shakacode/react-webpack-rails-tutorial) [![Coverage Status](https://coveralls.io/repos/shakacode/react-webpack-rails-tutorial/badge.svg?branch=master&service=github)](https://coveralls.io/github/shakacode/react-webpack-rails-tutorial?branch=master)
2-
3-
# React, Redux, Tailwind CSS, ES7, Webpack, Ruby on Rails Demo
4-
5-
* Server-Side Rendering of React via the [react_on_rails gem](https://github.com/shakacode/react_on_rails)
6-
* Live at [www.reactrails.com](http://www.reactrails.com/)
7-
8-
## Control Plane Deployment Example
9-
10-
[Control Plane](https://shakacode.controlplane.com) offers a viable, cost-saving alternative to Heroku, especially when using the [cpflow gem](https://rubygems.org/gems/cpflow) to deploy to Control Plane.
11-
12-
ShakaCode recently migrated [HiChee.com](https://hichee.com) to Control Plane, resulting in a two-thirds reduction in server hosting costs!
13-
14-
See doc in [./.controlplane/readme.md](./.controlplane/readme.md) for how to easily deploy this app to Control Plane.
15-
16-
The instructions leverage the `cpflow` CLI, with source code and many more tips on how to migrate from Heroku to Control Plane
17-
in https://github.com/shakacode/heroku-to-control-plane.
18-
19-
----
20-
21-
## React on Rails Pro and ShakaCode Pro Support
22-
23-
React on Rails Pro provides Node server rendering and other performance enhancements for React on Rails.
24-
25-
[![2018-09-11_10-31-11](https://user-images.githubusercontent.com/1118459/45467845-5bcc7400-b6bd-11e8-91e1-e0cf806d4ea4.png)](https://blog.shakacode.com/hvmns-90-reduction-in-server-response-time-from-react-on-rails-pro-eb08226687db)
26-
27-
* [HVMN Testimonial, Written by Paul Benigeri, October 12, 2018](https://github.com/shakacode/react_on_rails/blob/master/docs/testimonials/hvmn.md)
28-
* [HVMN’s 90% Reduction in Server Response Time from React on Rails Pro](https://blog.shakacode.com/hvmns-90-reduction-in-server-response-time-from-react-on-rails-pro-eb08226687db)
29-
* [Egghead React on Rails Pro Deployment Highlights](https://github.com/shakacode/react_on_rails/wiki/Egghead-React-on-Rails-Pro-Deployment-Highlights)
30-
31-
For more information, see the [React on Rails Pro Docs](https://www.shakacode.com/react-on-rails-pro/).
32-
33-
* Optimizing your front end setup with Webpack v5+ and Shakapacker for React on Rails including code splitting with loadable-components.
34-
* Upgrading your app to use the current Webpack setup that skips the Sprockets asset pipeline.
35-
* Better performance client and server side.
36-
37-
ShakaCode can also help you with your custom software development needs. We specialize in marketplace and e-commerce applications that utilize both Rails and React. We can even leverage our code for [HiChee.com](https://hichee.com) for your app!
38-
39-
See the [ShakaCode Client Engagement Model](https://www.shakacode.com/blog/client-engagement-model/) article to learn how we can work together.
40-
41-
------
42-
43-
## Community
44-
45-
* **[forum.shakacode.com](https://forum.shakacode.com)**: Post your questions
46-
* **[@railsonmaui on Twitter](https://twitter.com/railsonmaui)**
47-
* For a live, example of the code in this repo, see [www.reactrails.com](http://www.reactrails.com).
48-
49-
------
50-
51-
## Testimonials
52-
From Joel Hooks, Co-Founder, Chief Nerd at [egghead.io](https://egghead.io/), January 30, 2017:
53-
54-
![2017-01-30_11-33-59](https://cloud.githubusercontent.com/assets/1118459/22443635/b3549fb4-e6e3-11e6-8ea2-6f589dc93ed3.png)
55-
56-
For more testimonials, see [Live Projects](https://github.com/shakacode/react_on_rails/blob/master/PROJECTS.md) and [Kudos](https://github.com/shakacode/react_on_rails/blob/master/KUDOS.md).
57-
58-
-------
59-
60-
## Videos
61-
62-
### [React On Rails Tutorial Series](https://www.youtube.com/playlist?list=PL5VAKH-U1M6dj84BApfUtvBjvF-0-JfEU)
63-
64-
1. [History and Motivation](https://youtu.be/F4oymbUHvoY)
65-
2. [Basic Tutorial Walkthrough](https://youtu.be/_bjScw60FBk)
66-
3. [Code Walkthrough](https://youtu.be/McQ9UM-_ocQ)
67-
68-
## NEWS
69-
70-
* 2022-01-11: Added example of deployment [to the ControlPlane](.controlplane/readme.md).
71-
72-
You can see this tutorial live here: [http://reactrails.com/](http://reactrails.com/)
73-
74-
## Table of Contents
75-
76-
+ [Demoed Functionality](#demoed-functionality)
77-
+ [Technologies Involved](#technologies-involved)
78-
+ [Basic Demo Setup](#basic-demo-setup)
79-
+ [Basic Command Line](#basic-command-line)
80-
+ [Javascript Development without Rails](#javascript-development-without-rails-using-the-webpack-dev-server)
81-
+ [Rails Integration](#rails-integration)
82-
+ [Webpack](#webpack)
83-
+ [Configuration Files](#configuration-files)
84-
+ [Additional Resources](#additional-resources)
85-
+ [Sass, CSS Modules, and Tailwind CSS integration](#sass-css-modules-and-tailwind-css-integration)
86-
+ [Fonts with SASS](#fonts-with-sass)
87-
+ [Process Management during Development](#process-management-during-development)
88-
+ [Rendering with Express Server](#rendering-with-express-server)
89-
+ [Setup](#setup)
90-
+ [Contributors](#contributors)
91-
+ [About ShakaCode](#about-shakacode)
92-
+ [RubyMine and WebStorm](#rubymine-and-webstorm)
93-
+ [Open Code of Conduct](#open-code-of-conduct)
94-
95-
## Demoed Functionality
96-
97-
- Example of using the [react_on_rails gem](https://github.com/shakacode/react_on_rails) for easy react/webpack integration with Rails.
98-
- 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/).
99-
- 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!
100-
- Example of React/Redux with Rails Action Cable.
101-
- Example of Rails 7 with ReactJs/Redux/React-Router with Webpack and ES7.
102-
- Enabling development of a JS client independently from Rails using the [Webpack Dev Server](https://webpack.js.org/configuration/dev-server/). You can see this by starting the app and visiting http://localhost:4000
103-
- Enabling the use of npm modules and [Babel](https://babeljs.io/) with a Rails application using [Webpack](https://webpack.github.io/).
104-
- Easily enable retrofitting such a JS framework into an existing Rails app. You don't need a brand new single page app!
105-
- Example setting up Ruby and JavaScript linting in a real project, with corresponding CI rake tasks.
106-
- Enabling the i18n functionality with [react-intl](https://github.com/yahoo/react-intl).
107-
108-
### Technologies involved
109-
110-
See package.json and Gemfile for versions
111-
112-
1. [react_on_rails gem](https://github.com/shakacode/react_on_rails/)
113-
1. [React](http://facebook.github.io/react/)
114-
1. [Redux](https://github.com/reactjs/redux)
115-
1. [react-router](https://github.com/reactjs/react-router)
116-
1. [react-router-redux](https://github.com/reactjs/react-router-redux)
117-
1. [Webpack with hot-reload](https://github.com/webpack/docs/wiki/hot-module-replacement-with-webpack) (for local dev)
118-
1. [Babel transpiler](https://github.com/babel/babel)
119-
1. [Ruby on Rails 7](http://rubyonrails.org/) for backend app and comparison with plain HTML
120-
1. [Heroku for Rails 7 deployment](https://devcenter.heroku.com/articles/getting-started-with-rails7)
121-
1. [Deployment to the ControlPlane](.controlplane/readme.md)
122-
1. [Turbolinks 5](https://github.com/turbolinks/turbolinks)
123-
1. [Tailwind CSS](https://github.com/tailwindlabs/tailwindcss)
124-
125-
## Basic Demo Setup
126-
127-
### Prerequisites
128-
- Node `v22.3.0` or above. Be sure that you have Node installed! We suggest using [nvm](https://github.com/creationix/nvm) and running `nvm list` to check the active Node version. See this article [Updating and using nvm](http://forum.shakacode.com/t/updating-and-using-nvm/293).
129-
- Ruby 3.3.3 or above
130-
- Postgres v9.2 or above
131-
- Redis. Check that you have Redis installed by running `which redis-server`. If missing and on MacOS, install with Homebrew (`brew install redis`)
132-
- [Yarn](https://yarnpkg.com/).
133-
134-
### Setup
135-
1. `git clone git@github.com:shakacode/react-webpack-rails-tutorial.git`
136-
1. `cd react-webpack-rails-tutorial`
137-
1. `bundle install`
138-
1. `yarn`
139-
1. `rake db:setup`
140-
1. `rails start`
141-
- Open a browser tab to http://localhost:3000 for the Rails app example
142-
143-
### Basic Command Line
144-
- Run all linters and tests: `rake`
145-
- See all npm commands: `yarn run`
146-
- To start all development processes: `foreman start -f Procfile.dev`
147-
- To start only all Rails development processes: `foreman start -f Procfile.hot`
148-
149-
## Rails Integration
150-
**We're now using Webpack for all Sass and JavaScript assets so we can do CSS Modules within Rails!**
151-
152-
+ **Production Deployment**: [heroku-deployment.md](https://github.com/shakacode/react_on_rails/blob/master/docs/additional-reading/heroku-deployment.md).
153-
+ Configure Buildpacks
154-
```
155-
heroku buildpacks:set heroku/ruby --app your-app
156-
heroku buildpacks:add --index 1 heroku/nodejs --app your-app
157-
heroku buildpacks:set --index 3 https://github.com/sreid/heroku-buildpack-sourceversion.git --app your-app
158-
```
159-
160-
## Testing
161-
+ See [Yak Shaving Failing Integration Tests with React and Rails](https://blog.shakacode.com/yak-shaving-failing-integration-tests-with-react-a93444886c8c#.io9464uvz)
162-
163-
+ Be sure to see [Integration Test Notes](./docs/integration-test-notes.md) for advice on running your integration tests.
164-
165-
+ **Testing Mode**: When running tests, it is useful to run `foreman start -f Procfile.spec` in order to have webpack automatically recompile the static bundles. Rspec is configured to automatically check whether or not this process is running. If it is not, it will automatically rebuild the webpack bundle to ensure you are not running tests on stale client code. This is achieved via the `ReactOnRails::TestHelper.configure_rspec_to_compile_assets(config)`
166-
line in the `rails_helper.rb` file. If you are using this project as an example and are not using RSpec, you may want to implement similar logic in your own project.
167-
168-
## Webpack
169-
170-
_Converted to use Shakapacker webpack configuration_.
171-
172-
173-
### Additional Resources
174-
- [Webpack Docs](https://webpack.js.org/)
175-
- [Webpack Cookbook](https://christianalfoni.github.io/react-webpack-cookbook/)
176-
- Good overview: [Pete Hunt's Webpack Howto](https://github.com/petehunt/webpack-howto)
177-
178-
## Sass, CSS Modules, and Tailwind CSS Integration
179-
This example project uses mainly Tailwind CSS for styling.
180-
Besides this, it also demonstrates Sass and CSS modules, particularly for some CSS transitions.
181-
182-
We're using Webpack to handle Sass assets so that we can use CSS modules. The best way to understand how we're handling assets is to close follow this example. We'll be working on more docs soon. If you'd like to give us a hand, that's a great way to learn about this!
183-
184-
For example in [client/app/bundles/comments/components/CommentBox/CommentBox.jsx](client/app/bundles/comments/components/CommentBox/CommentBox.jsx), see how we use standard JavaScript import syntax to refer to class names that come from CSS modules:
185-
186-
```javascript
187-
import css from './CommentBox.module.scss';
188-
189-
export default class CommentBox extends React.Component {
190-
render() {
191-
const { actions, data } = this.props;
192-
const cssTransitionGroupClassNames = {
193-
enter: css.elementEnter,
194-
enterActive: css.elementEnterActive,
195-
exit: css.elementLeave,
196-
exitActive: css.elementLeaveActive,
197-
};
198-
}
199-
}
200-
```
201-
202-
### Fonts with SASS
203-
The tutorial makes use of a custom font OpenSans-Light. We're doing this to show how to add assets for the CSS processing. The font files are located under [client/app/assets/fonts](client/app/assets/fonts) and are loaded by both the Rails asset pipeline and the Webpack HMR server.
204-
205-
## Process management during development
206-
```
207-
bundle exec foreman start -f <Procfile>
208-
```
209-
210-
1. [`Procfile.dev`](Procfile.dev): Starts the Webpack Dev Server and Rails with Hot Reloading.
211-
1. [`Procfile.static`](Procfile.dev-static): Starts the Rails server and generates static assets that are used for tests.
212-
213-
## Contributors
214-
[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)
215-
216-
### RubyMine and WebStorm
217-
Special thanks to [JetBrains](https://www.jetbrains.com) for their great tools: [RubyMine](https://www.jetbrains.com/ruby/) and [WebStorm](https://www.jetbrains.com/webstorm/). Some developers of this project use RubyMine at the top level, mostly for Ruby work, and we use WebStorm opened up to the `client` directory to focus on JSX and Sass files.
218-
219-
### Hiring
220-
221-
We're looking for great developers that want to work with Rails + React (and react-native!) with a remote-first, distributed, worldwide team, for our own products, client work, and open source. [More info here](http://www.shakacode.com/about/index.html#work-with-us).
222-
223-
---
224-
225-
## Thank you from Justin Gordon and [ShakaCode](http://www.shakacode.com)
226-
227-
Thank you for considering using [React on Rails](https://github.com/shakacode/react_on_rails).
228-
229-
Aloha and best wishes from the ShakaCode team!
1+
testing

0 commit comments

Comments
 (0)