$ 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)
我很难分辨出我的gulp任务失败的原因以及原因。如何增加默认堆栈跟踪?
答案 0 :(得分:0)
添加评论和管道工:
添加此辅助方法:
log =(msg) - &gt; console.log消息 #你将以块状态收到乙烯基文件 transform =(file,cb) - &gt; #读取和修改文件内容 #file.contents = new Buffer(String(file.contents)+&#39;一些修改后的内容&#39;);
# if there was some error, just pass as the first parameter here
cb(null, file);
#返回地图将导致您的变换函数被调用
#为您收到的每个块(文件)。而当这个流
#收到一个&#39;结束&#39;信号,它也将结束。
#
#此外,您希望在其他地方需要event-stream
。
return eventStream.map(transform);
在任务中的步骤之间管道记录方法:
gulp.task&#39; myTask&#39;, - &gt; gulp.src myCss, base:myBase .pipe log&#34;得到css文件!&#34; .pipe concat&#39; app.css&#39; .pipe log&#34; concated css !!&#34;
这是用coffeescript编写的,你可以在这里把它变成javascript: http://js2coffee.org/
创建一个catch错误辅助方法:
catchError =(错误) - &gt; plugins.util.beep()#ref; console.log错误
将水管工添加到插件中:
gulp.task&#39; myTask&#39;, - &gt; gulp.src myCss, base:myBase .pipe plugins.plumber errorHandler:catchError .pipe log&#34;得到css文件!&#34; .pipe concat&#39; app.css&#39; .pipe log&#34; concated css !!&#34;
完成! :)
查看更多资源: gulp-print gulp-debug