Saturday 3 June 2017

Passing command line (npm) arguments trough multiple levels

I'm currently working with angular-webpack2-starter which has already predefined npm tasks, but they don't work properly (at least for me).

Here you can see complete package.json

Excerpt with commands I'm using

"scripts": {
  "sass": "node-sass \"src/app/styles.scss\" \"src/app/styles.css\" --include-path node_modules --output-style compressed -q",
  "sass:watch": "node-sass -w  \"src/app/styles.scss\" \"src/app/styles.css\"  --include-path node_modules --output-style compressed -q",
  "server:universal": "nodemon dist/server.js",
  "clean:dist": "npm run rimraf -- dist .awcache",
  "build:universal": "npm run build:universal:prod",
  "build:universal:prod": "npm run clean:dist && npm run sass && webpack",
  "watch:universal": "npm-run-all -p -r \"build:universal -- --watch\" sass:watch",
  "universal:watch": "npm run build:universal && npm-run-all -p -r watch:universal server:universal"
}

The problem seems to be in
"watch:universal": "npm-run-all -p -r \"build:universal -- --watch\" sass:watch", , because --watch doesn't propagate to webpack command.

If I run build:universal -- -- --watch it works as expected.

Note the double (-- --)

Is it the right way to run it like this ?



via Stevik

No comments:

Post a Comment