gulp-mtime-correction
v1.0.3
Published
Change the modification times of your files - helps with checking modification time for the same files on different servers in different time zones (eg for using gulp-newer for ftp transfers)
Downloads
32
Maintainers
Readme
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'));