Call “ng build” from inside a gulp task

后端 未结 1 1723
遥遥无期
遥遥无期 2021-02-19 14:49

I am using angular-cli in my project.I want to add some gulp tasks for deployment. Is it possible for me to call \"ng build\" from inside a gulp task ?

相关标签:
1条回答
  • 2021-02-19 15:25

    you can use child_process to make a command line call:

    var exec = require('child_process').exec;
    
    gulp.task('build', function (cb) {
      exec('ng build', function (err, stdout, stderr) {
        console.log(stdout);
        console.log(stderr);
        cb(err);
      });
    })
    

    see also here: Running a shell command from gulp for other solutions.

    0 讨论(0)
提交回复
热议问题