import * as util from 'gulp-util' ; import * as rimraf from 'rimraf' ; param { string or export function clean ( paths ) { return done => { let pathsToClean ; if ( paths instanceof Array ) { pathsToClean = paths ; } else { pathsToClean = [ < string > paths ] ; } let promises = pathsToClean . map ( p => { return new Promise ( resolve => { rimraf ( p , e => { if ( e ) { util . log ( 'Clean task failed with' , e ) ; } else { util . log ( 'Deleted' , util . colors . yellow ( p || '-' ) ) ; } resolve ( ) ; } ) ; } ) ; } ) ; Promise . all ( promises ) . then ( ( ) => done ( ) ) ; } ; }