react_rails_webpack 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +34 -13
- data/lib/react_rails_webpack/version.rb +1 -1
- data/lib/tasks/print_server_info.rake +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c564775a3830635f1296ef6927ed3421bbe54662
|
4
|
+
data.tar.gz: f7398865699cd5202092ebc330a13f996a2abd5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6d301c7768c55a2ab4715d9ffcc0a9f7e1c8489ddbd98655664647894008ea392b98a654f68b64706c3770dfe635867548dff8b974d03d54911f6424bf0bffe
|
7
|
+
data.tar.gz: 30147f1de1a0648e9728696ee120fefb55d77be1f65eea3297c8f55909a453219ae9b94d45812bba029c032ff331bd22f6811c824981c65c4d44405793d0d40f
|
data/README.md
CHANGED
@@ -9,38 +9,59 @@ A set of Rails generators that create all the necessary boilerplate code (with e
|
|
9
9
|
3. Automatically sets up working demo examples so you can jump into React immediately
|
10
10
|
4. Development server for React components will live update your changes to any device on your local network (including phones)
|
11
11
|
|
12
|
-
##
|
13
|
-
|
14
|
-
### Install
|
12
|
+
## Install
|
15
13
|
|
16
14
|
1. Make sure you have the [requirements](#requirements) installed
|
17
15
|
2. Add `gem 'react_rails_webpack'` to your Gemfile
|
18
16
|
3. Run `bundle install`
|
19
17
|
4. Run `rails g react_rails_webpack:install` ([further explanation of what this does](#how-does-this-work))
|
20
18
|
|
21
|
-
|
19
|
+
## See demo components
|
20
|
+
|
21
|
+
### On webpack dev server
|
22
|
+
|
23
|
+
1. Run the webpack dev server with `npm run start`
|
24
|
+
2. Go to the url specified by the `rake react_rails_webpack:print_server_info` command
|
25
|
+
|
26
|
+
### On your rails app
|
27
|
+
|
28
|
+
1. Generate an example page in rails with the `rails g react_rails_webpack:create_example_page` command
|
29
|
+
2. Start your Rails server with `rails s`
|
30
|
+
3. Go to [localhost:3000/greeting](localhost:3000/greeting)
|
31
|
+
|
32
|
+
## Commands
|
22
33
|
|
23
|
-
|
34
|
+
### Set up the integration
|
24
35
|
|
25
|
-
|
36
|
+
`rails g react_rails_webpack:install`
|
26
37
|
|
27
|
-
|
38
|
+
Further explanation of what this does [here](#how-does-this-work).
|
28
39
|
|
29
|
-
Sets up an example page in your Rails app
|
40
|
+
### Sets up an example page in your Rails app
|
30
41
|
|
31
|
-
|
42
|
+
`rails g react_rails_webpack:create_example_page`
|
32
43
|
|
33
|
-
|
44
|
+
Sets up an example page in your Rails app at [localhost:3000/greeting](http://localhost:3000/greeting) that displays the two example components.
|
34
45
|
|
35
|
-
|
46
|
+
### Configure react_rails_webpack on a new clone of your repo
|
47
|
+
|
48
|
+
`rails g react_rails_webpack:new_fork`
|
49
|
+
|
50
|
+
**You must run this whenever you clone a repo with a react_rails_webpack integration setup**. It generates [the environment.json file](lib/react_rails_webpack/client/environment.json) based on your computer's network name. Since the network name will be different for most computers, this file is gitignored and needs to be regenerated for each new computer the project is cloned on.
|
51
|
+
|
52
|
+
### See the url of your webpack development server
|
53
|
+
|
54
|
+
`rake react_rails_webpack:print_server_info`
|
36
55
|
|
37
56
|
This command will tell you the url of your webpack development server on your local network.
|
38
57
|
|
39
|
-
|
58
|
+
### Generate react component Trailblazer cell
|
59
|
+
|
60
|
+
`rails g react_rails_webpack:trailblazer_integration`
|
40
61
|
|
41
62
|
If you use the Trailblazer gem, use this command to add a [trailblazer](https://github.com/apotonick/trailblazer) cell for react components to your `lib` folder.
|
42
63
|
|
43
|
-
|
64
|
+
## Suggested Development Workflow
|
44
65
|
|
45
66
|
1. Write the code for your React components in the [client/src/components](lib/react_rails_webpack/client/src/components) directory
|
46
67
|
2. Test your new components with live reloading by running the webpack dev server with the command `npm run start` (note: the base html page for the webpack dev server is based on the html provided to `context.defaultTemplate` in [the webpack.config.js file](lib/react_rails_webpack/client/webpack.config.js))
|
@@ -5,8 +5,8 @@ namespace :react_rails_webpack do
|
|
5
5
|
puts
|
6
6
|
puts "-" * `tput cols`.to_i # print line of dashes
|
7
7
|
puts
|
8
|
-
puts "To run a live-reloading webpack server for
|
9
|
-
|
8
|
+
puts "To run a live-reloading webpack server for your React \
|
9
|
+
components, run #{'npm run start'.white.bold}, then go to #{(`scutil --get LocalHostName`.strip + '.local:3000').blue.bold}"
|
10
10
|
puts
|
11
11
|
puts "-" * `tput cols`.to_i # print line of dashes
|
12
12
|
puts
|