Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fe4aeaa

Browse files
Use npm run to run client scripts
1 parent 054fb18 commit fe4aeaa

File tree

6 files changed

+11
-9
lines changed

6 files changed

+11
-9
lines changed

‎.travis.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ rvm:
55
install:
66
- bundle install
77
- npm install
8-
- cd client && $(npm bin)/webpack --config webpack.rails.config.js
8+
- cd client && npm run build
99
env:
1010
- export RAILS_ENV=test
1111
script:

‎Procfile.dev‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
web: rails s -p 4000
2-
client: sh -c 'cd client && $(npm bin)/webpack -w --config webpack.rails.config.js'
3-
hot: sh -c 'cd client && node server.js'
2+
client: sh -c 'rm app/assets/javascripts/generated/* || true && cd client && npm run build:dev'
3+
hot: sh -c 'cd client && npm start'

‎README.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ the JS bundle. We've chosen to let Rails handle CSS, SCSS, images, fonts.
102102

103103
```
104104
cd client
105-
$(npm bin)/webpack -w --config webpack.rails.config.js
105+
npm run build:dev
106106
```
107107

108108
`client-bundle.js` is generated and saved to `app/assets/javascripts`. This is included in the
@@ -182,7 +182,7 @@ jQuery and jQuery-ujs are not required within `app/assets/javascript/application
182182
and have been moved under`/client` and managed by npm. The modules are exposed via entry point
183183
by `webpack.common.config.js`.
184184

185-
In `application.js`, it's critical that any libraries that depend on jQuery come after the inclusion
185+
In `application.js`, it's critical that any libraries that depend on jQuery come after the inclusion
186186
of the Webpack bundle, such as the twitter bootstrap javascript.
187187

188188
Please refer to [Considerations for jQuery with Rails and Webpack](http://forum.railsonmaui.com/t/considerations-for-jquery-with-rails-and-webpack/344) for further info.
@@ -260,7 +260,7 @@ Run the tests with `rspec`.
260260
### RubyMine/Webstorm Linting Configuration
261261
* I started out trying to make RubyMine and WebStorm catch and fix linting errors. However, I find
262262
it faster to just do this with the command line. Your mileage may vary.
263-
* Create a custom scope like this for RubyMine, named "Inspection Scope"
263+
* Create a custom scope like this for RubyMine, named "Inspection Scope"
264264

265265
file[react-rails-tutorial]:*/&&!file[react-rails-tutorial]:tmp//*&&!file[react-rails-tutorial]:log//*&&!file[react-rails-tutorial]:client/node_modules//*&&!file[react-rails-tutorial]:client/assets/fonts//*&&!file[react-rails-tutorial]:app/assets/fonts//*&&!file[react-rails-tutorial]:bin//*&&!file[react-rails-tutorial]:app/assets/javascripts//*
266266

@@ -289,7 +289,7 @@ WebStorm opened up to the `client` directory to focus on JSX and Sass files.
289289

290290
# Misc Tips
291291

292-
## Cleanup local branches merged to master
292+
## Cleanup local branches merged to master
293293
```
294294
alias git-cleanup-merged-branches='git branch --merged master | grep -v master | xargs git branch -d'
295295
```

‎client/package.json‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@
6767
"scripts": {
6868
"test": "echo \"Error: no test specified\" && exit 1",
6969
"start": "node server.js",
70+
"build": "NODE_ENV=production webpack --config webpack.rails.config.js",
71+
"build:dev": "webpack -w --config webpack.rails.config.js",
7072
"lint": "npm run eslint && npm run jscs",
7173
"eslint": "eslint --ext .js,.jsx .",
7274
"jscs": "jscs --verbose ."

‎client/webpack.rails.config.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Run like this:
2-
// cd client && $(npm bin)/webpack -w --config webpack.rails.config.js
2+
// cd client && npm run build:dev
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

‎lib/tasks/assets.rake‎

Lines changed: 1 addition & 1 deletion
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 client && $(npm bin)/webpack --config webpack.rails.config.js"
16+
sh "cd client && npm run build"
1717
end
1818

1919
task :clobber do

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /