在我的项目中,我需要gulp来查看我/ src /文件夹中的更改文件,并将它们上传到/ public / ftp文件夹。
问题是 - 这需要太长时间,因为乙烯基-ftp首先按字母顺序列出项目中的所有文件夹并上传新文件,然后它才会到达包含已更改文件的文件夹。
这是我的部署任务:
gulp.task('deploy', function () {
var conn = ftp.create({
host: '123',
user: '123',
password: '123',
parallel: 1,
log: gutil.log
});
var globs = [
'src/**',
'!' + baseskindir + '_fonts/**',
'!' + baseskindir + '_img/**',
'!' + baseskindir + '_js/**',
'!' + baseskindir + '_scss/**',
'!' + baseskindir + 'css/maps/**',
'!' + baseskindir + '_sprite/**'
];
// using base = '.' will transfer everything to /public_html correctly
// turn off buffering in gulp.src for best performance
return gulp.src(globs, {base: './src', buffer: false})
.pipe(conn.newerOrDifferentSize('/123/public')) // only upload newer files
.pipe(conn.dest('/123/public'));
});
此任务的结果:
Starting 'deploy'...
[17:14:02] CONN
[17:14:03] READY
[17:14:03] MLSD /stage.123.com/
[17:14:03] LIST /stage.123.com/
[17:14:03] MLSD /stage.123.com/public
[17:14:03] LIST /stage.123.com/public
[17:14:03] MLSD /stage.123.com/public/GeoIp
[17:14:03] LIST /stage.123.com/public/GeoIp
[17:14:04] MLSD /stage.123.com/public/skin
[17:14:04] LIST /stage.123.com/public/skin
[17:14:04] MLSD /stage.123.com/public/app
[17:14:04] LIST /stage.123.com/public/app
[17:14:04] MLSD /stage.123.com/public/js
[17:14:04] LIST /stage.123.com/public/js
[17:14:04] MLSD /stage.123.com/public/skin/adminhtml
[17:14:04] LIST /stage.123.com/public/skin/adminhtml
[17:14:04] MLSD /stage.123.com/public/app/code
[17:14:04] LIST /stage.123.com/public/app/code
[17:14:04] MLSD /stage.123.com/public/app/design
[17:14:04] LIST /stage.123.com/public/app/design
[17:14:04] MLSD /stage.123.com/public/skin/frontend
[17:14:04] LIST /stage.123.com/public/skin/frontend
[17:14:05] MLSD /stage.123.com/public/app/etc
[17:14:05] LIST /stage.123.com/public/app/etc
[17:14:05] MLSD /stage.123.com/public/app/locale
[17:14:05] LIST /stage.123.com/public/app/locale
[17:14:05] MLSD /stage.123.com/public/js/onestepcheckout
[17:14:05] LIST /stage.123.com/public/js/onestepcheckout
它一直持续到它到达文件夹已更改的文件夹。
它迟早会上传,但我不能再等了。