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: CHANGELOG.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,7 +55,7 @@ See [Release Notes](docs/release-notes/15.0.0.md) for full details.
55
55
56
56
#### Fixed
57
57
58
-
- Separated streamServerRenderedReactComponent from the ReactOnRails object in order to stop users from getting errors during webpack compilation about needing the `stream-browserify` package. [PR 1680](https://github.com/shakacode/react_on_rails/pull/1680) by [judahmeek](https://github.com/judahmeek).
58
+
- Separated streamServerRenderedReactComponent from the ReactOnRails object in order to stop users from getting errors during Webpack compilation about needing the `stream-browserify` package. [PR 1680](https://github.com/shakacode/react_on_rails/pull/1680) by [judahmeek](https://github.com/judahmeek).
59
59
- Removed obsolete `js-yaml` peer dependency. [PR 1678](https://github.com/shakacode/react_on_rails/pull/1678) by [alexeyr-ci](https://github.com/alexeyr-ci).
Copy file name to clipboardExpand all lines: NEWS.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ _A history of the news. A few bullets at the top will also show on the [README.m
5
5
-**October 14, 2020**: [RUBY ROGUES
6
6
RR 474: React on Rails V12 – Don’t Shave That Yak! with Justin Gordon](https://devchat.tv/ruby-rogues/rr-474-react-on-rails-v12-dont-shave-that-yak-with-justin-gordon/).
7
7
8
-
-**October 1, 2020**: See the [spec/dummy](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy) example repo for a simple configuration of webpack via the rails/webpacker gem
8
+
-**October 1, 2020**: See the [spec/dummy](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy) example repo for a simple configuration of Webpack via the rails/webpacker gem
9
9
that supports SSR.
10
10
-**August 2, 2020**: See the example repo of [React on Rails Tutorial With SSR, HMR fast refresh, and TypeScript](https://github.com/shakacode/react_on_rails_demo_ssr_hmr) for a new way to setup the creation of your SSR bundle with `rails/webpacker`.
11
11
- July 8, 2020: Release **v12**.
@@ -23,7 +23,7 @@ _A history of the news. A few bullets at the top will also show on the [README.m
23
23
- 2017-03-06: Updated to Webpack v2!
24
24
- 2017-03-02: Demo of internationalization (i18n) is live at [reactrails.com](https://www.reactrails.com/). Docs [here](docs/guides/i18n.md).
25
25
- 2017-02-28: See [discussions here on Webpacker](https://github.com/rails/webpacker/issues/139) regarding how Webpacker will allow React on Rails to avoid using the asset pipeline in the near future.
26
-
- 2017-02-28: Upgrade to Webpack v2 or use the `--bail` option in your webpack script for test and production builds. See the discussion on [PR #730](https://github.com/shakacode/react_on_rails/pull/730).
26
+
- 2017-02-28: Upgrade to Webpack v2 or use the `--bail` option in your Webpack script for test and production builds. See the discussion on [PR #730](https://github.com/shakacode/react_on_rails/pull/730).
27
27
- 2016-11-03: Spoke at [LA Ruby: "React on Rails: Why, What, and How?"](http://www.meetup.com/laruby/events/234825187/). [Video and pictures in this article](https://blog.shakacode.com/my-react-on-rails-talk-at-the-la-ruby-rails-meetup-november-10-2016-eaaa83aff800#.ej6h4eglp).
28
28
- 2016-12-20: New Video on Egghead.io: [Creating a component with React on Rails](https://egghead.io/lessons/react-creating-a-component-with-react-on-rails)
29
29
- 2016-11-03: Spoke at [LA Ruby, 7pm, Thursday, November 10 in Venice, CA: "React on Rails: Why, What, and How?"](http://www.meetup.com/laruby/events/234825187/). [Video and pictures in this article](https://blog.shakacode.com/my-react-on-rails-talk-at-the-la-ruby-rails-meetup-november-10-2016-eaaa83aff800#.ej6h4eglp).
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,7 @@ If you think ShakaCode can help your project, [click here](https://meetings.hubs
44
44
45
45
## React on Rails Pro
46
46
47
-
Are you interested in optimizing your webpack setup for React on Rails, including code splitting with [react-router](https://github.com/ReactTraining/react-router#readme) and [loadable-components](https://loadable-components.com/) with server-side rendering for SEO and hot-reloading for developers?
47
+
Are you interested in optimizing your Webpack setup for React on Rails, including code splitting with [react-router](https://github.com/ReactTraining/react-router#readme) and [loadable-components](https://loadable-components.com/) with server-side rendering for SEO and hot-reloading for developers?
48
48
We did this for Popmenu, [lowering Heroku costs 20-25% while getting a 73% decrease in average response times](https://www.shakacode.com/recent-work/popmenu/). Several years later, Popmenu serves tens of millions of SSR requests daily with React on Rails Pro.
49
49
50
50
If you're interested, read more about [React on Rails Pro](https://www.shakacode.com/react-on-rails-pro/) and [book a call](https://meetings.hubspot.com/justingordon/30-minute-consultation).
Copy file name to clipboardExpand all lines: docs/additional-details/generator-details.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,7 @@ Another good option is to create a simple test app per the [Tutorial](https://ww
43
43
44
44
The generated client code follows our organization scheme. Each unique set of functionality is given its own folder inside of `app/javascript/app/bundles`. This encourages modularity of _domains_.
45
45
46
-
Inside of the generated "HelloWorld" domain you will find the following folders:
46
+
Inside the generated "HelloWorld" domain you will find the following folders:
47
47
48
48
-`startup`: contains the entry point files for webpack. It defaults to a single file that is used for both server and client compilation. But if these need to be different, then you can create two Webpack configurations with separate endpoints. Since RoR v14.2 this is strongly recommended because the client can import `react-on-rails/client` instead of `react-on-rails` for decreased bundle size.
49
49
-`containers`: contains "smart components" (components that have functionality and logic that is passed to child "dumb components").
Copy file name to clipboardExpand all lines: docs/additional-details/manual-installation-overview.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,14 +15,14 @@ The only requirements within this directory for basic React on Rails integration
15
15
1. Provide server rendering if you wish to use that feature.
16
16
1. Your JavaScript code "registers" any components and stores per the ReactOnRails APIs of ReactOnRails.register(components) and ReactOnRails.registerStore(stores). See [our javascript API docs](https://www.shakacode.com/react-on-rails/docs/api/javascript-api/) and the [ReactOnRails.js source](https://github.com/shakacode/react_on_rails/tree/master/node_package/src/ReactOnRails.js).
17
17
1. Set your registration file as an "entry" point in your Webpack configs.
18
-
1. You create scripts in `client/package.json` per the example apps. These are used for building your Webpack assets. Also do this for your toplevel `package.json`.
18
+
1. You create scripts in `client/package.json` per the example apps. These are used for building your Webpack assets. Also do this for your top-level `package.json`.
19
19
20
20
## Rails Steps (outside of /client)
21
21
22
-
1. Add `gem "webpacker"` to the Gemfile, run bundle. The gem provides the `stylesheet_pack_tag` and `javascript_pack_tag` helpers which is used to load the bundled assets to your layouts.[Dummy Example](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/app/views/layouts/application.html.erb)
22
+
1. Add `gem "shakapacker"` to the Gemfile, run `bundle`. The gem provides the `stylesheet_pack_tag` and `javascript_pack_tag` helpers, which are used to load the bundled assets to your layouts.[Dummy Example](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/app/views/layouts/application.html.erb).
23
23
1. Configure the `config/initializers/react_on_rails.rb`. You can adjust some necessary settings and defaults. See file [https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/config/initializers/react_on_rails.rb](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/config/initializers/react_on_rails.rb) for a detailed example of configuration, including comments on the different values to configure.
24
24
1. Configure your Procfiles per the example apps. These are at the root of your Rails installation.
25
-
1. Configure your toplevel JavaScript files for inclusion in your layout. You'll want a version that you use for static assets, and you want a file for any files in your setup that are not part of your webpack build. The reason for this is for use with hot-reloading. If you are not using hot reloading, then you only need to configure your `application.js` file to include your Webpack generated files.
26
-
1. If you are deploying to Heroku, see [our heroku deployment documentation](https://www.shakacode.com/react-on-rails/docs/deployment/heroku-deployment/)
25
+
1. Configure your top-level JavaScript files for inclusion in your layout. You'll want a version that you use for static assets, and a separate file for any files in your setup that are not part of your Webpack build. The reason for this is for use with hotreloading. If you are not using hot reloading, then you only need to configure your `application.js` file to include your Webpack generated files.
26
+
1. If you are deploying to Heroku, see [our Heroku deployment documentation](https://www.shakacode.com/react-on-rails/docs/deployment/heroku-deployment/).
27
27
28
28
If I missed anything, please submit a PR or file an issue.
Copy file name to clipboardExpand all lines: docs/additional-details/recommended-project-structure.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,13 +2,13 @@
2
2
3
3
The React on Rails generator uses the standard Shakapacker convention of this structure:
4
4
5
-
```yml
5
+
```text
6
6
app/javascript:
7
7
├── bundles:
8
-
│ #Logical groups of files that can be used for code splitting
8
+
│ #Logical groups of files that can be used for code splitting
9
9
│ └── hello-world-bundle.js
10
10
├── packs:
11
-
│ #only webpack entry files here
11
+
│ #only webpack entry files here
12
12
│ └── hello-world-bundle.js
13
13
```
14
14
@@ -19,7 +19,7 @@ you should consider keeping your codebase mostly consistent with the defaults fo
19
19
20
20
1. Move the directory:
21
21
22
-
```
22
+
```sh
23
23
mv app/javascript client
24
24
```
25
25
@@ -53,11 +53,11 @@ You have 2 basic choices:
53
53
54
54
### Simple Rails Way
55
55
56
-
This isn't really any technique, as you keep handling all your styling assets using Rails standard tools, such as using the [sass-rails gem](https://rubygems.org/gems/sass-rails/versions/5.0.4). Basically, Webpack doesn't get involved with styling. Your Rails layouts just doing the styling the standard Rails way.
56
+
This isn't really a technique, as you keep handling all your styling assets using Rails standard tools, such as using the [sass-rails gem](https://rubygems.org/gems/sass-rails/versions/5.0.4). Basically, Webpack doesn't get involved with styling. Your Rails layouts just continue doing the styling the standard Rails way.
57
57
58
58
#### Advantages to the Simple Rails Way
59
59
60
-
1. Much simpler! There's no changes really from your current processes.
60
+
1. Much simpler! There's no change from your current processes.
61
61
62
62
### Using Webpack to Manage Styling Assets
63
63
@@ -70,6 +70,6 @@ This technique involves customization of the webpack config files to generate CS
70
70
71
71
#### Advantages to having Webpack Manage Styles
72
72
73
-
1. You can use [CSS modules](https://github.com/css-modules/css-modules), which is super compelling once you seen the benefits.
73
+
1. You can use [CSS modules](https://github.com/css-modules/css-modules), which is super compelling once you see the benefits.
74
74
1. You can use CSS in JS.
75
75
1. You can do hot reloading of your assets. Thus, you do not have to refresh your web page to see asset change, including changing styles.
Copy file name to clipboardExpand all lines: docs/additional-details/updating-dependencies.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Updating Dependencies
2
2
3
-
If you frequently update you dependencies in small batches, you will avoid large and painful updates later. Then again, if you don't have good tests coverage, it's hazardous to update dependencies at any time.
3
+
If you frequently update dependencies in small batches, you will avoid large and painful updates later. Then again, if you don't have good test coverage, it's hazardous to update dependencies at any time.
4
4
5
5
## Ruby
6
6
@@ -16,11 +16,11 @@ bundle update
16
16
1. Run `yarn outdated` and read CHANGELOGs of major updated packages before you update. You might not be ready for some updates.
17
17
1. Run these commands. You may or may not need to `rm -rf` your `node_modules` directory.
Copy file name to clipboardExpand all lines: docs/api/view-helpers-api.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,7 +97,7 @@ end %>
97
97
98
98
### rails_context
99
99
100
-
You can call `rails_context` or `rails_context(server_side: true|false)` from your controller or view to see what values are in the Rails Context. Pass true or false depending on whether you want to see the serverside or the clientside rails_context. Typically, for computing cache keys, you should leave server_side as the default true. When calling this from a controller method, use `helpers.rails_context`.
100
+
You can call `rails_context` or `rails_context(server_side: true|false)` from your controller or view to see what values are in the Rails Context. Pass true or false depending on whether you want to see the server-side or the client-side rails_context. Typically, for computing cache keys, you should leave `server_side` as the default true. When calling this from a controller method, use `helpers.rails_context`.
Copy file name to clipboardExpand all lines: docs/contributor-info/linters.md
+13-12Lines changed: 13 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,33 +7,37 @@ These linters support the [ShakaCode Style Guidelines](https://www.shakacode.com
7
7
If you haven't tried the autofix options for `eslint` and `rubocop`, you're seriously missing out!
8
8
9
9
1. Be **SURE** you have a clean git status, as you'll want to review what the autofix does to your code!
10
-
2.**Rubocop:** Be sure to be in the right directory where you have Ruby files, probably the top level of your Rails project.
10
+
2.**Rubocop:** Be sure to be in the correct directory where you have Ruby files, usually the top level of your Rails project.
11
11
12
-
```
12
+
```bash
13
13
rubocop -a
14
14
```
15
15
16
-
3.**eslint:**: Be sure to be in the right directory where you have JS files.
16
+
3.**ESLint:** Be sure to be in the correct directory where you have JS files.
17
17
18
-
```
18
+
```bash
19
19
eslint --fix .
20
20
```
21
21
22
22
or
23
23
24
-
```
24
+
```bash
25
25
npm run lint -- --fix
26
26
```
27
27
28
28
Autofixing is a **HUGE** time saver!
29
29
30
30
## ESLint
31
31
32
+
See the [ESLint](http://eslint.org/) website for more information.
33
+
32
34
### Configuring Rules
33
35
34
-
Rules are configured with a 0, 1 or 2. Setting a rule to 0 is turning it off, setting it to 1 triggers a warning if that rule is violated, and setting it to 2 triggers an error.
36
+
See [the documentation](https://eslint.org/docs/latest/use/configure/rules) first.
37
+
38
+
Rule severity is configured with `'off'`, `'warn'` or `'error'`. In older configurations you can see `0`, `1`, and `2` instead.
35
39
36
-
Rules can also take a few additional options. In this case, the rule can be set to an array, the first item of which is the 0/1/2 flag and the rest are options.
40
+
Rules can also take a few additional options. In this case, the rule can be set to an array, the first item of which is the severity and the rest are options.
37
41
38
42
See file [.eslintrc](https://github.com/shakacode/react_on_rails/tree/master/.eslintrc) for examples of configuration
39
43
@@ -63,9 +67,6 @@ alert('more alert');
63
67
64
68
You can disable all rules for a line or block, or only specific rules, as shown above.
0 commit comments