@@ -19,7 +19,6 @@ In no particular order:
19191 . React 0.11 (for front-end app)
20202 . React-bootstrap 0.12
21213 . Webpack with hot-reload 1.4 (for local dev)
22- 4 . Webpack ExtractTextPlugin (to extract CSS out of JS bundle)
23224 . ES6 transpiler (es6-loader) 0.2
24235 . Rails 4.2 (for backend app)
25246 . Heroku (for deployment)
@@ -35,13 +34,6 @@ cd webpack && node server.js
3534
3635Point browser to [ http://0.0.0.0:3000 ] ( ) .
3736
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- ```
4537
4638Save a change to a JSX file and see it update immediately in the browser! Note,
4739any 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
6153
6254```
6355cd 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
6565```
6666
6767## Run Rails server
@@ -81,7 +81,7 @@ It's important to run the Rails server on a different port than the node server.
8181
8282# Webpack configuration
8383- ` 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.
8585- ` webpack.common.config.js ` : Common configuration file to minimize code duplication.
8686
8787# Bootstrap integration
@@ -94,16 +94,36 @@ assets are loaded through Webpack (with help of the bootstrap-sass-loader).
9494See webpack/webpack.hot.config.js.
9595
9696
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
99119webpack/assets/stylesheets/_ bootstrap-variables-customization.scss and the
100120webpack/assets/stylesheets directory added to the Rails asset pipeline
101121search path. See config config/application.rb. Keep that in mind as you
102- need to customize Bootstrap.
122+ customize the Bootstrap Sass variables .
103123
104124# Notes on Rails assets
105125## 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
107127by the Rails asset pipeline.
108128
109129## Sass and images
0 commit comments