Skip to content

Commit 1288fd8

Browse files
committed
Renamed /webpack directory to /client
* Avoids confusion between the `webpack` executable and the `/client` directory.
1 parent 39486f2 commit 1288fd8

27 files changed

+24
-19
lines changed

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
/log/*.log
1616
/tmp
1717
/public/assets
18-
webpack-bundle.js
19-
webpack-bundle.js.map
18+
client-bundle.js
19+
client-bundle.js.map
2020
.env
2121
/node_modules
2222
npm-debug.log

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
v1.1 - Sunday, March 22, 2015
2+
------------------------------
3+
1. Changed /webpack directory to /client

Procfile.dev

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
web: rails s -p 4000
2-
webpack: cd webpack && $(npm bin)/webpack -w --config webpack.rails.config.js
3-
hot: cd webpack && node server.js
2+
client: cd client && $(npm bin)/webpack -w --config webpack.rails.config.js
3+
hot: cd client && node server.js

README.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
By Justin Gordon and the Rails On Maui Team, http://www.railsonmaui.com
44

5+
- If you came to here from the blog article, this example project has evolved. See CHANGELOG.md for
6+
what's changed.
57
- Please email us at [[email protected]](mailto:[email protected]) if you have a ReactJs +
68
Rails project.
79
- Please file issues for problems and feature requests.
@@ -64,7 +66,7 @@ See package.json and Gemfile for versions
6466
Setup node and run the node server with file `server.js`.
6567

6668
```
67-
cd webpack
69+
cd client
6870
node server.js
6971
```
7072

@@ -85,11 +87,11 @@ Webpack ExtractTextPlugin can optionally be used to extract the CSS out of
8587
the JS bundle. We've chosen to let Rails handle CSS, SCSS, images, fonts.
8688

8789
```
88-
cd webpack
90+
cd client
8991
$(npm bin)/webpack -w --config webpack.rails.config.js
9092
```
9193

92-
`webpack-bundle.js` is generated and saved to `app/assets/javascripts`. This is included in the
94+
`client-bundle.js` is generated and saved to `app/assets/javascripts`. This is included in the
9395
Rails asset pipeline.
9496

9597
Observe how the bundles are automatically re-generated whenever your JSX changes.
@@ -155,7 +157,7 @@ customize the Bootstrap Sass variables.
155157

156158
# Notes on Rails assets
157159
## Javascript
158-
The `webpack.rails.config.js` file generates webpack-bundle.js which is then included
160+
The `webpack.rails.config.js` file generates client-bundle.js which is then included
159161
by the Rails asset pipeline.
160162

161163
## Sass and images
@@ -232,5 +234,5 @@ shrinkwrap`.
232234
Special thanks to [JetBrains](https://www.jetbrains.com) for their great tools
233235
[RubyMine](https://www.jetbrains.com/ruby/) and [WebStorm](https://www.jetbrains.com/webstorm/).
234236
The developers of this project use RubyMine at the top level, mostly for Ruby work, and we use
235-
WebStorm opened up to the `webpack` directory to focus on JSX and Sass files.
237+
WebStorm opened up to the `client` directory to focus on JSX and Sass files.
236238

app/assets/javascripts/application.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717

1818
// Important to import jquery_ujs before rails-bundle as that patches jquery xhr to use the authenticity token!
1919

20-
//= require webpack-bundle
20+
//= require client-bundle
2121
//= require turbolinks

app/assets/stylesheets/_bootstrap-custom.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Customizations - needs to be imported first!
22
// The _bootstrap-variables-customization.scss file is located under
3-
// webpack/assets/stylesheets, which has been added to the Rails asset
3+
// client/assets/stylesheets, which has been added to the Rails asset
44
// pipeline search path. See config/application.rb.
55
@import "bootstrap-variables-customization";
66

app/assets/stylesheets/application.css.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// with Rails vs. the Webpack Dev Server
33
$rails: true;
44

5-
// Those scss files are located under webpack/assets/stylesheets,
5+
// Those scss files are located under client/assets/stylesheets,
66
// which has been added to the Rails asset pipeline search path.
77
// See config/application.rb.
88
@import "bootstrap-custom";
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

webpack/webpack.hot.config.js renamed to client/webpack.hot.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Run like this:
2-
// cd webpack && node server.js
2+
// cd client && node server.js
33

44
var path = require("path");
55
var config = require("./webpack.common.config");

webpack/webpack.rails.config.js renamed to client/webpack.rails.config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
// Run like this:
2-
// cd webpack && $(npm bin)/webpack -w --config webpack.rails.config.js
2+
// cd client && $(npm bin)/webpack -w --config webpack.rails.config.js
33
// Note that Foreman (Procfile.dev) has also been configured to take care of this.
44

55
// NOTE: All style sheets handled by the asset pipeline in rails
66

77
var config = require("./webpack.common.config");
88

99
config.entry.push("./scripts/rails_only"); // rails specific assets
10-
config.output = { filename: "webpack-bundle.js",
10+
config.output = { filename: "client-bundle.js",
1111
path: "../app/assets/javascripts" };
1212
config.externals = { jquery: "var jQuery" }; // load jQuery from cdn or rails asset pipeline
1313
config.module.loaders.push(
1414
{ test: /\.jsx$/, loaders: ["es6", "jsx?harmony"] },
15-
// Next 2 lines expose jQuery and $ to any JavaScript files loaded after webpack-bundle.js
15+
// Next 2 lines expose jQuery and $ to any JavaScript files loaded after client-bundle.js
1616
// in the Rails Asset Pipeline. Thus, load this one prior.
1717
{ test: require.resolve("jquery"), loader: "expose?jQuery" },
1818
{ test: require.resolve("jquery"), loader: "expose?$" }

config/application.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Application < Rails::Application
2323
# For not swallow errors in after_commit/after_rollback callbacks.
2424
config.active_record.raise_in_transactional_callbacks = true
2525

26-
# Add webpack/assets/stylesheets to asset pipeline's search path.
27-
config.assets.paths << Rails.root.join("webpack", "assets" ,"stylesheets")
26+
# Add client/assets/stylesheets to asset pipeline's search path.
27+
config.assets.paths << Rails.root.join("client", "assets" ,"stylesheets")
2828
end
2929
end

lib/tasks/assets.rake

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace :assets do
1313

1414
desc 'Compile assets with webpack'
1515
task :webpack do
16-
sh 'cd webpack && $(npm bin)/webpack --config webpack.rails.config.js'
16+
sh 'cd client && $(npm bin)/webpack --config webpack.rails.config.js'
1717
end
1818

1919
task :clobber do

0 commit comments

Comments
 (0)