
Research
/Security News
Contagious Interview Campaign Escalates With 67 Malicious npm Packages and New Malware Loader
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
gulp-rev-outdated
Advanced tools
Old static asset revision files filter.
$ npm install --save-dev gulp-rev-outdated
We can use gulp-rev to cache-bust several assets. Every modification of source files caused a new revisioned asset creation. In case of using separate http://static.exsample.com/ domain for distributing static assets we have some problem with a lot of accumulated revisioned asset files. If we have several different frontends (e.q. [www-1.exsample.com, www-2.exsample.cpm, ... www-12.exsample com]) worked with different software releases, We can't remove all revisioned asset files on static.exsample.com. We need to save number of recent revisioned assets. gulp-rev-outdated filter revisioned assets and exclude parametrised quantity of recent files for removing.
Takes one parameter [ keepQuantity ] - number of saved recent files. Default value == 2.
var gulp = require('gulp');
var gutil = require('gulp-util');
var rimraf = require('rimraf');
var revOutdated = require('gulp-rev-outdated');
var path = require('path');
var through = require('through2');
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('clean', function() {
gulp.src( ['dist/js/vendors*.js'], {read: false})
.pipe( revOutdated(1) ) // leave 1 latest asset file
.pipe( cleaner() );
gulp.src( ['dist/js/bundle*.js'], {read: false})
.pipe( revOutdated(3) ) // leave 3 recent assets
.pipe( cleaner() );
gulp.src( ['dist/css/*.css'], {read: false})
.pipe( revOutdated() ) // leave 2 recent assets (default value)
.pipe( cleaner() );
return;
});
It's also possible to pass in all your asset files at once:
[...]
gulp.task('clean', function() {
gulp.src( ['dist/**/*.*'], {read: false})
.pipe( revOutdated(1) ) // leave 1 latest asset file for every file name prefix.
.pipe( cleaner() );
return;
});
gulp.src option read false prevents gulp to read the contents of the file and makes this task a lot faster. If you need the file and it's contents after cleaning in the same stream, do not set the read option to false.
FAQs
Old static asset revision files filter
The npm package gulp-rev-outdated receives a total of 232 weekly downloads. As such, gulp-rev-outdated popularity was classified as not popular.
We found that gulp-rev-outdated demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.