Gulp调试 - 管道到process.stdout给出TypeError('无效数据')

时间:2014-10-29 19:56:54

标签: javascript angularjs gulp

我正在尝试调试我编写的Gulp任务。我尝试使用'gulp-debug'模块,但它真正做的只是stat一个文件......这对我来说没用。

首先,如何让流程进入终端?我想看看wiredep正在输出什么。我试过了.pipe(process.stdout),但我得到了TypeError('invalid data')

var bowerStream = gulp.src('./app/bower_components')
    .pipe(wiredep())
    .pipe(process.stdout)

2 个答案:

答案 0 :(得分:0)

使用through2这是可能的:

gulp.src('./app/index.html')
  .pipe(wiredep({directory: './app/bower_components'}))
  .pipe(through2.obj(function(obj, enc, next) {
    this.push(obj.contents);
    next();
  })).pipe(process.stdout);

答案 1 :(得分:0)

我知道这有点晚了,我刚刚写了一篇关于如何在visual studio代码中调试gulp任务的博客文章: https://hansrwindhoff.wordpress.com/2015/05/05/debugging-task-runner-tasks-like-gulp-with-visual-studio-code-editordebugger/

您可以启动VSCode调试器来运行gulp任务,然后对所有插件和gulpfiles执行完整的源代码级调试。非常方便!