Search code examples
npmgulpangular-cliwatch

Use ng build watch & gulp watch on the same console


I would like to use ng build --watch & gulp watch:ng on the same console

Here's my task code

gulp.task('watch:ng', function () {
  gulp.watch('ng/dist/ng/*', gulp.series('copy-ng'));
});

I want to copy/merge the scripts to another location when angular rebuild the project


Solution

  • I found a solution using npm-run-all

    npm install npm-run-all --save-dev

    "scripts": {
      "build:watch": "ng build --deleteOutputPath=false --watch",
      "gulp:watch": "gulp watch:ng",
      "rebuild": "run-p build:watch gulp:watch",
    }
    

    npm run rebuild