File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed
Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -24,8 +24,23 @@ Default value == 2.
2424
2525``` js
2626var gulp = require (' gulp' );
27- var revOutdated = require (' gulp-rev-outdated' );
28- var cleaner = require (' gulp-rimraf' );
27+ var gutil = require (' gulp-util' );
28+ var rimraf = require (' rimraf' );
29+ var revOutdated = require (' gulp-rev-outdated' );
30+ var path = require (' path' );
31+ var through = require (' through2' );
32+
33+ function cleaner () {
34+ return through .obj (function (file , enc , cb ){
35+ rimraf ( path .resolve ( (file .cwd || process .cwd ()), file .path ), function (err ) {
36+ if (err) {
37+ this .emit (' error' , new gutil.PluginError (' Cleanup old files' , err));
38+ }
39+ this .push (file);
40+ cb ();
41+ }.bind (this ));
42+ });
43+ }
2944
3045gulp .task (' clean' , function () {
3146 gulp .src ( [' dist/js/vendors*.js' ], {read: false })
@@ -63,8 +78,6 @@ gulp.src option read false prevents gulp to read the contents of the file and ma
6378### Works with gulp-rev-outdated
6479
6580- [ gulp-rev] ( https://github.com/sindresorhus/gulp-rev )
66- - [ gulp-rimraf] ( https://github.com/robrich/gulp-rimraf )
67- - [ gulp-clean] ( https://github.com/peter-vilja/gulp-clean )
6881
6982## License
7083
Original file line number Diff line number Diff line change 11{
22 "name" : " gulp-rev-outdated" ,
3- "version" : " 0.0.7 " ,
3+ "version" : " 0.0.8 " ,
44 "description" : " Old static asset revision files filter" ,
55 "license" : " MIT" ,
66 "repository" : {
You can’t perform that action at this time.
0 commit comments