1.0.3 • Published 7 years ago

gulp-mtime-correction v1.0.3

Weekly downloads
168
License
MIT
Repository
github
Last release
7 years ago

npm install gulp-mtime-correction --save-dev

// task to move timezone of build folder files forward to match live server
gulp.task('tz:forward', () => {

    gutil.log('Moving build folder forward');

    return gulp.src(dir.build + '/**/*')
    .pipe(mtime(5))
    .pipe(gulp.dest(dir.build));
});


// task to move timezone of build folder files back to local time
gulp.task('tz:back', () => {

    gutil.log('Moving build folder back');

    return gulp.src(dir.build + '/**/*')
    .pipe(mtime(-5))
    .pipe(gulp.dest(dir.build));
});


// task for ftp deployment of only newer files
gulp.task( 'deploy', () => {

    var conn = ftp.create( FTP.connOpts );

    // turn off buffering in gulp.src for best performance 
    return gulp.src( FTP.src , { base: FTP.base, buffer: false } )
        .pipe( conn.newer( FTP.directoryPath ) ) // only upload newer files 
        .pipe( conn.dest( FTP.directoryPath ) );
} );



// ftp deployment allowing for timezone difference
// file mtimes are moved in sequence before and after the deployment

gulp.task( 'ftp', gulpSequence('tz:forward','deploy','tz:back'));