gulp.watch文件变化,是否有变化完成事件?

var stream = gulp.watch("../web/*", function(event){
  ...
  //打印stream
  console.log(stream);
})

想通过gulp.watch监测web文件变化,待变化完成后将web/*中的文件转移到另外一个地方,不知道gulp是否有提供变化完成的事件?
打印stream看到了这些东西,但貌似都不能满足要求,求高手指点,谢谢!

EventEmitter {
    domain: null,
    _events: { end: [Function] },
    _eventsCount: 1,
    _maxListeners: undefined,
    end: [Function],
    add: [Function],
    remove: [Function],
    _watcher:
     Gaze {
       domain: null,
       _events:
        { end: [Function: bound cb],
          error: [Function: bound cb],
          ready: [Function: bound cb],
          nomatch: [Function: bound cb],
          all: [Function] },
       }
    ...
 }
阅读 3.6k
1 个回答

先定义个 gulp.task('move', function(){ gulp.src().pipe(gulp.dist())}) 作用就是移动文件。。
gulp.watch(glob[, opts], tasks) //官方API http://www.gulpjs.com.cn/docs/api/
gulp.watch('web/*', ['move'])

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进