How to clean a project correctly with gulp?

后端 未结 6 1670
悲哀的现实
悲哀的现实 2020-12-25 10:45

On the gulp page there is the following example:

gulp.task(\'clean\', function(cb) {
  // You can use multiple globbing patterns as you would with `gulp.src`         


        
6条回答
  •  生来不讨喜
    2020-12-25 10:47

    Use del.sync. It completes the del and then returns from the task

    gulp.task('clean', function () {
        return $.del.sync([path.join(conf.paths.dist, '/**/*')]);
    });
    

    and be sure clean is the first task in a list of tasks. For example,

    gulp.task('build', ['clean', 'inject', 'partials'], function ()  {
        //....
    }
    

    @Ben i liked the way you have separated clean:css clean:js tasks. That's a great tip

提交回复
热议问题