1
我正在使用Gulp观看文件,通过ftp上传文件,并在上传完成时发送通知。我不知道如何连接这些插件来使其工作。现在,我有:Gulp - 通过ftp上传文件后通知
var gulp = require('gulp'),
ftp = require('gulp-ftp'),
watch = require('gulp-watch'),
notify = require('gulp-notify');
var markupWatcher = watch({ glob: 'src/*.php', name: 'markup' });
markupWatcher.gaze.on('all', function(event, path) {
options.remotePath = ftpData.remotePath;
gulp.src(path)
.pipe(ftp(options))
.on('finish', function() {
console.log('test');
notify({title: 'File Uploaded', message: 'test'});
});
我认为需要通知要传递给.pipe()
,但我不知道该怎么做,在这方面(的回调内.on()
)。在控制台上打印“测试”,但通知无声。
这似乎是一个简单的任务,但不熟悉Node会让Gulp变得困难。
感谢您的任何建议。
什么使你使用'finish'事件,而不是仅仅通过管道流'通知'? – Ben 2014-09-04 21:07:12
如果您只是通过管道通知,那么通知将在文件上传完成之前显示。 – nichoth 2014-09-05 22:10:23