Skip to content

Instantly share code, notes, and snippets.

@bryanforbes
Created December 6, 2014 00:16
Show Gist options
  • Save bryanforbes/2f37d6f64b2e79337723 to your computer and use it in GitHub Desktop.
Save bryanforbes/2f37d6f64b2e79337723 to your computer and use it in GitHub Desktop.
var gulp = require('gulp');
var filter = require('gulp-filter');
var vinylPaths = require('vinyl-paths');
var fs = require('fs');
gulp.task('clean', function (cb) {
var vp = vinylPaths();
gulp.src([ '**/{*.js,*.js.map}', '!node_modules/**/*' ], { read: false })
.pipe(filter(function (file) {
var jsName = file.path.match(/(.*\.js)(?:\.map)?$/)[1];
return fs.existsSync(jsName) && fs.existsSync(jsName + '.map');
}))
.pipe(vp)
.on('end', function () {
console.log('PATHS', vp.paths);
cb();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment