Gulp vinyl-ftp upload taking too long

185 Views Asked by At

In my project i need gulp to watch files for changes in my /src/ folder and upload them to /public/ ftp folder.

The problem is - it takes too long because vinyl-ftp first gets listing of all folders in project by alphabet and uploads new files only then it reach the folder that contains changed file.

Here is my deploy task:

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'));

});

Result of this task:

     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

And it goes on and on until it reaches folder with changed file.

It will upload it sooner or later, but i just cant wait for it anymore.

0

There are 0 best solutions below