johnpapa / gulp-patterns

Playground for Gulp Recipes
500 stars 146 forks source link

clean functions do no longer work due to change in nodes del plugin #109

Open MW3000 opened 8 years ago

MW3000 commented 8 years ago

Description from this (http://stackoverflow.com/questions/32770896/nodes-del-command-callback-not-firing) Stackoverflow question: "The callback on the del function is not firing. The del function is running, file are deleted, I see no error messages. If I call the callback manually it executes, so looks like the function is in tact. So I am wondering what would cause del not to want to execute the callback."

This seems to be the solution: "The [del] API now returns a promise instead of accepting a callback function." https://github.com/sindresorhus/del/releases/tag/v2.0.0

prasannakapate commented 8 years ago

This should work

gulp.task('clean-styles', function() {
    var files = [].concat(
        config.temp + '**/*.css',
        config.build + 'styles/**/*.css'
    );
    clean(files);
});

function clean(path) {
    log('Cleaning: ' + $.util.colors.blue(path));
    return del(path);
}