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 ?
            Asked
            
        
        
            Active
            
        
            Viewed 8,392 times
        
    14
            
            
        - 
                    1Were you ever able to get this working? It didn't work for me, even with child_process like the answer suggests. – Sharvari Desai Oct 19 '16 at 20:02
 
1 Answers
18
            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.
- 
                    3Don't forget to navigate to project folder (if your **gulpfile** isn't in the same folder): `exec('cd ./../client && ng build', function(...` – Gil Epshtain Aug 19 '19 at 08:11