如何增加gulp任务的堆栈跟踪?

lfe*_*445 6 node.js gulp

$ gulp patch
[17:13:27] Requiring external module coffee-script/register
[17:13:28] Using gulpfile ~/source/sem-campaign.js/gulpfile.coffee
[17:13:28] Starting 'bump'...
[17:13:28] Starting 'add'...
[17:13:28] Bumped version to: 1.0.2
[17:13:28] Bumped version to: 1.0.2
[17:13:28] Finished 'bump' after 31 ms
[17:13:28]
[17:13:28] Finished 'add' after 30 ms
[17:13:28] Starting 'commit'...
[?] enter a commit msg, eg initial commit: initial commit
[17:13:32] Finished 'commit' after 3.26 s
[17:13:32] Starting 'patch'...
no buddy
[17:13:32] Finished 'patch' after 25 ?s

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: Command failed:
  at ChildProcess.exithandler (child_process.js:648:15)
  at ChildProcess.emit (events.js:98:17)
  at maybeClose (child_process.js:756:16)
  at Socket.<anonymous> (child_process.js:969:11)
  at Socket.emit (events.js:95:17)
Run Code Online (Sandbox Code Playgroud)

我很难说出我的gulp任务失败的原因以及原因.如何增加默认堆栈跟踪?

gol*_*cks 0

添加评论和水管工:

  1. 添加这个辅助方法:

    log = (msg) -> console.log msg # 你将以块的形式接收 Vinyl 文件transform = (file, cb) -> # 读取和修改文件内容 # file.contents = new Buffer(String(file.contents) ) + '一些修改的内容');

    # if there was some error, just pass as the first parameter here
    cb(null, file);
    
    Run Code Online (Sandbox Code Playgroud)

    # 返回地图将导致为您收到的每个块(文件)调用您的转换函数。当该流接收到“结束”信号时,它也将结束。# # 此外,您还需要event-stream其他地方的内容。返回 eventStream.map(transform);

  2. 任务中步骤之间的管道 thw log 方法:

    gulp.task 'myTask', -> gulp.src myCss, base: myBase .pipe log "有 css 文件!" .pipe concat 'app.css' .pipe log“连接的CSS!!”

这是用coffeescript编写的,你可以在这里将其转换为javascript: http://js2coffee.org/

  1. 创建一个捕获错误辅助方法:

    catchError = (err) -> plugins.util.beep() # ref ; 控制台.log 错误

  2. 将水管工添加到插件中:

    gulp.task 'myTask',-> gulp.src myCss,base:myBase .pipe plugins.plumber errorHandler:catchError .pipe log“有CSS文件!” .pipe concat 'app.css' .pipe log“连接的CSS!!”

完毕!:)

更多资源可供查看: gulp-print gulp-debug