Skip to content

Latest commit

 

History

History

19-08-2017

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

When creating small or medium sized repositories, I prefer using ordinary npm scripts to gulp/grunt/<other build system> tasks (to avoid unreasonable complexity and dependencies). There is an understandable need of running a few scripts in parallel: the same as gulp.parallel does (e.g. running webpack -w and node.js server listening on a specific port). Today I have learned a very convenient way of doing this: using concurrently library.

"scripts": {
   "webpack:watch": "node ./build/webpack --development --watch",
   "serve:watch": "nodemon ./dist/server/index.js",
   "start": "concurrently --kill-others \"npm run webpack:watch\" \"npm run serve:watch\""
 }

Now with npm start there are 2 concurrently running processes, both prefixed with its own appropriate prefix:

concurrently

Still, keep in mind that on a UNIX based machines you could achieve the similar result without any 3rd party tools by just using a pipe operator:

"start": "npm run webpack:watch | npm run serve:watch