Skip to content

Instantly share code, notes, and snippets.

@f1yn
Last active August 31, 2017 00:11
Show Gist options
  • Select an option

  • Save f1yn/a1e7f043a9c8ac41c86be89c522f1a37 to your computer and use it in GitHub Desktop.

Select an option

Save f1yn/a1e7f043a9c8ac41c86be89c522f1a37 to your computer and use it in GitHub Desktop.
Proper clean function for gulp.
var del = require('del');
var gulp = require('gulp');
var buildDirectory = './path/to/something';
// the offical way to delete files (from del docs)
gulp.task('clean', ()=>{
return del.sync(buildDirectory);
});
// the callback method (promises)
gulp.task('clean:async', (callback)=>{
del(buildDirectory).then(() => { callback() } );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment