@@ -19,7 +19,6 @@ In no particular order:
19
19
1 . React 0.11 (for front-end app)
20
20
2 . React-bootstrap 0.12
21
21
3 . Webpack with hot-reload 1.4 (for local dev)
22
- 4 . Webpack ExtractTextPlugin (to extract CSS out of JS bundle)
23
22
4 . ES6 transpiler (es6-loader) 0.2
24
23
5 . Rails 4.2 (for backend app)
25
24
6 . Heroku (for deployment)
@@ -35,13 +34,6 @@ cd webpack && node server.js
35
34
36
35
Point browser to [ http://0.0.0.0:3000 ] ( ) .
37
36
38
- Make sure to invoke your local copy of the webpack executable as opposed
39
- to any globally installed webpack.
40
- See https://github.com/webpack/extract-text-webpack-plugin/blob/master/example/webpack.config.js
41
- If in doubt, run the following command:
42
- ```
43
- $(npm bin)/webpack --config webpack.hot.config.js
44
- ```
45
37
46
38
Save a change to a JSX file and see it update immediately in the browser! Note,
47
39
any browser state still exists, such as what you've typed in the comments box.
@@ -61,7 +53,15 @@ Observe how the bundles are automatically re-generated whenever your JSX changes
61
53
62
54
```
63
55
cd webpack
64
- webpack -w --config webpack.rails.config.js
56
+ webpack -w --config webpack.bundle.config.js
57
+ ```
58
+
59
+ Make sure to invoke your local copy of the webpack executable as opposed
60
+ to any globally installed webpack.
61
+ See https://github.com/webpack/extract-text-webpack-plugin/blob/master/example/webpack.config.js
62
+ If in doubt, run the following command:
63
+ ```
64
+ $(npm bin)/webpack -w --config webpack.bundle.config.js
65
65
```
66
66
67
67
## Run Rails server
@@ -81,7 +81,7 @@ It's important to run the Rails server on a different port than the node server.
81
81
82
82
# Webpack configuration
83
83
- ` webpack.hot.config.js ` : Used by server.js to run the demo express server.
84
- - ` webpack.rails .config.js ` : Used to generate the Rails bundles.
84
+ - ` webpack.bundle .config.js ` : Used to generate the Rails bundles.
85
85
- ` webpack.common.config.js ` : Common configuration file to minimize code duplication.
86
86
87
87
# Bootstrap integration
@@ -94,16 +94,36 @@ assets are loaded through Webpack (with help of the bootstrap-sass-loader).
94
94
See webpack/webpack.hot.config.js.
95
95
96
96
97
- To avoid duplicating any Bootstrap customization between Rails and Webpack,
98
- all Bootstrap customizations have been consolidated under Webpack in
97
+ Bootstrap can be customized by hand-picking which modules to load and/or overwriting
98
+ some of the Sass variables defined by the frameworks.
99
+
100
+ ## Bootstrap modules customization
101
+
102
+ If you are not using all the Bootstrap modules then you'll likely want to customize
103
+ it to avoid loading unused assets. This customization is done in separate files
104
+ for the Rails app versus the Webpack dev server so it's important to keep these
105
+ in-sync as you develop your app in parallel using the Rails and the Webpack HMR
106
+ environments.
107
+
108
+ - Rails Bootstrap customization file: app/assets/stylesheets/_ bootstrap-custom.scss
109
+ - Webpack HMR Bootstrap customization file: webpack/bootstrap-sass.config.js
110
+
111
+ ## Bootstrap variables customization
112
+
113
+ If you need to customize some of the Sass variables defined in Bootstrap you
114
+ can do so by overwriting these variables in a separate file and have it loaded
115
+ before other Bootstrap modules.
116
+
117
+ To avoid duplicating this customization between Rails and Webpack HMR,
118
+ this custom code has been consolidated under Webpack in
99
119
webpack/assets/stylesheets/_ bootstrap-variables-customization.scss and the
100
120
webpack/assets/stylesheets directory added to the Rails asset pipeline
101
121
search path. See config config/application.rb. Keep that in mind as you
102
- need to customize Bootstrap.
122
+ customize the Bootstrap Sass variables .
103
123
104
124
# Notes on Rails assets
105
125
## Javascript
106
- The ` webpack.rails .config.js ` file generates rails-bundle.js which is then included
126
+ The ` webpack.bundle .config.js ` file generates rails-bundle.js which is then included
107
127
by the Rails asset pipeline.
108
128
109
129
## Sass and images
0 commit comments