Open WraithKenny opened 6 years ago
A workaround in the meantime is
.pipe( through2.obj( function( file, enc, cb ) {
var date = new Date();
file.stat.atime = date;
file.stat.mtime = date;
cb( null, file );
}) )
.pipe( gulp.dest( './' ) )
(This is what I used to test... I didn't actually compile gulp-less and really test.)
👍 This change in gulp 4 breaks plugins such as gulp-less-changed, gulp-newer, et al. that rely on the output file times for incremental build optimisation.
I am attempting to utilize the work around solution because it is hosing up my ability to add versioning to css files. I understand that this has nothing to do with LESS but any help would be appreciated. I would like to add the pipe that WraithKenny started above:
.pipe( through2.obj( function( file, enc, cb ) { var date = new Date(); file.stat.atime = date; file.stat.mtime = date; cb( null, file ); }) )
How can I add that pipe to work with the following function
function cssversion () {
return gulp.src("_cms/templates/layouts/headBotto*.php")
.pipe(versionNumber({
append: {
'to': [
{'type': 'css',
attr : ['href'],
key : '_v',
value: '%DT%',
'cover' : 1
}
]
}
}))
.pipe(through2.obj( function( file, enc, cb ) {
let date = new Date();
file.stat.atime = date;
file.stat.mtime = date;
cb( null, file );
}) )
.pipe(gulp.dest("_cms/templates/layouts/"));
}
FYI, this new "feature" is really annoying
Gulp 4 intentionally avoids updating the mtime of output files, as a "new feature."
As per https://github.com/gulpjs/gulp/issues/2193#issuecomment-399168738 gulp-less should deliberately update the mtime of the output css file itself, else the file will always retain it's old mtime (for example, my compiled css file, which I've changed today, still says last updated aug 24th).