-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Hi @shonny-ua,
I can't seem to get this plugin to work as intended. Old revisions are not being removed.
Here are my two tasks. One to create revisions and one to clean them up.
function cleaner() {
return through.obj(function(file, enc, cb){
rimraf( path.resolve( (file.cwd || process.cwd()), file.path), function (err) {
if (err) {
this.emit('error', new gutil.PluginError('Cleanup old files', err));
}
this.push(file);
cb();
}.bind(this));
});
}
gulp.task( 'rev', function() {
// by default, gulp would pick `assets/css` as the base,
// so we need to set it explicitly:
gulp.src([paths.css + '/child-theme.min.css', paths.js + '/child-theme.min.js'], {base: './'})
.pipe(rev())
.pipe(gulp.dest('./')) // write rev'd assets to build dir
.pipe(rev.manifest({
merge: true // merge with the existing manifest if one exists
}))
.pipe(gulp.dest('./')); // write manifest to build dir
});
gulp.task( 'rev-clean', function() {
gulp.src([paths.css + '/*.css'], {read: false})
.pipe( revOutdated(2) ) // leave 2 recent assets (default value)
.pipe( cleaner() );
return;
});
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels