@@ -45,10 +45,13 @@ the browser.
45
45
## Build JS/CSS bundles
46
46
Run this command to have webpack build the JS/CSS bundles and have them saved in the Rails
47
47
asset pipeline (app/assets).
48
- The Webpack ExtractTextPlugin can optionally be used to extract the CSS out of
49
- the JS bundle. The following bundles would then be generated:
50
- - rails-bundle.js which gets saved to app/assets/javascripts
48
+ Although not shown in this tutorial, the Webpack ExtractTextPlugin can optionally be used
49
+ to extract the CSS out of the JS bundle.
50
+
51
+ The following bundles are generated:
52
+ - webpack-bundle.js which gets saved to app/assets/javascripts
51
53
- bootstrap-and-customizations.css which gets saved in app/assets/stylesheets
54
+
52
55
Observe how the bundles are automatically re-generated whenever your JSX changes.
53
56
54
57
```
@@ -59,14 +62,16 @@ webpack -w --config webpack.rails.config.js
59
62
Make sure to invoke your local copy of the webpack executable as opposed
60
63
to any globally installed webpack.
61
64
See https://github.com/webpack/extract-text-webpack-plugin/blob/master/example/webpack.config.js
62
- If in doubt, run the following command:
65
+
66
+ If in doubt, run the following command, which ensures that your local webpack copy
67
+ gets picked:
63
68
```
64
69
$(npm bin)/webpack -w --config webpack.rails.config.js
65
70
```
66
71
67
72
## Run Rails server
68
73
69
- Once the JS/CSS bundled have been generated into the Rails asset pipeline, you can start
74
+ Once the JS/CSS bundles have been generated into the Rails asset pipeline, you can start
70
75
the Rails server.
71
76
72
77
```
@@ -75,14 +80,16 @@ bundle install
75
80
rake db:setup
76
81
rails s -p 4000
77
82
```
78
- Point your browser to [ http://0.0.0.0:4000 ] ( ) .
79
83
80
- It's important to run the Rails server on a different port than the node server.
84
+ Now point your browser to [ http://0.0.0.0:4000 ] ( ) .
85
+
86
+ Note that it's important to run the Rails server on a different port than the node server.
81
87
82
88
# Webpack configuration
83
- - ` webpack.hot.config.js ` : Used by server.js to run the demo express server.
89
+ - ` webpack.hot.config.js ` : Used by server.js to run the demo HMR server.
84
90
- ` webpack.rails.config.js ` : Used to generate the Rails bundles.
85
- - ` webpack.common.config.js ` : Common configuration file to minimize code duplication.
91
+ - ` webpack.common.config.js ` : Common configuration file to minimize code duplication
92
+ between the HMR and Rails configurations.
86
93
87
94
# Bootstrap integration
88
95
Notice that Bootstrap Sass is installed as both a gem and an npm package.
0 commit comments