This repository was archived by the owner on Oct 2, 2019. It is now read-only.
File tree 3 files changed +10
-15
lines changed
3 files changed +10
-15
lines changed Original file line number Diff line number Diff line change 1
1
# Run Rails & Webpack concurrently
2
2
# Example file from webpack-rails gem
3
3
rails : bundle exec rails server
4
- webpack : ./node_modules/.bin/webpack-dev-server --config config/webpack.config.js
4
+ webpack : npm start
Original file line number Diff line number Diff line change 2
2
"name" : " webpack-rails-example" ,
3
3
"version" : " 0.0.1" ,
4
4
"license" : " MIT" ,
5
+ "scripts" : {
6
+ "compile" : " webpack -d --config config/webpack.config.js" ,
7
+ "serve" : " webpack-dev-server -p --config config/webpack.config.js"
8
+ },
5
9
"dependencies" : {
6
10
"stats-webpack-plugin" : " ^0.2.1" ,
7
11
"webpack" : " ^1.9.11" ,
Original file line number Diff line number Diff line change 1
1
namespace :webpack do
2
2
desc "Compile webpack bundles"
3
- task compile : :environment do
4
- ENV [ "TARGET" ] = 'production' # TODO: Deprecated, use NODE_ENV instead
3
+ task ( :compile ) do
5
4
ENV [ "NODE_ENV" ] = 'production'
6
- webpack_bin = ::Rails . root . join ( ::Rails . configuration . webpack . binary )
7
- config_file = ::Rails . root . join ( ::Rails . configuration . webpack . config_file )
8
-
9
- unless File . exist? ( webpack_bin )
10
- raise "Can't find our webpack executable at #{ webpack_bin } - have you run `npm install`?"
11
- end
12
-
13
- unless File . exist? ( config_file )
14
- raise "Can't find our webpack config file at #{ config_file } "
15
- end
16
-
17
- sh "#{ webpack_bin } --config #{ config_file } --bail"
5
+ sh "npm run compile"
18
6
end
7
+
8
+ desc "Start webpack dev server"
9
+ task ( :serve ) { sh "npm serve" }
19
10
end
You can’t perform that action at this time.
0 commit comments