调用“ng build"从 gulp 任务内部 [英] Call "ng build" from inside a gulp task

查看:17
本文介绍了调用“ng build"从 gulp 任务内部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中使用 angular-cli.我想添加一些 gulp 任务进行部署.我可以从 gulp 任务内部调用ng build"吗?

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 ?

推荐答案

可以使用 child_process 进行命令行调用:

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);
  });
})

另见此处:从 gulp 运行 shell 命令 其他解决方案.

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

这篇关于调用“ng build"从 gulp 任务内部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆