peter-vilja / gulp-clean

A gulp plugin for removing files and folders from given paths.
178 stars 21 forks source link

Event 'end' not fired #14

Open binarykitchen opened 10 years ago

binarykitchen commented 10 years ago

For my project I need to reuse parts of my Gulp file for other tasks, for example cleanJs():

function cleanJs(cb) {
    gulp.src(..., {read: false})
        .pipe(clean())
        .on('end', function() {
            console.log('never called');
            cb();
        });
}

gulp.task('one task', function(cb) {
    cleanJs(cb);
    ...
});

gulp.task('other task', function(cb) {
    cleanJs(cb);
    ...
});

This does not seem to work. Not sure what the case is here or if I am doing something wrong.

jonathanrdelgado commented 10 years ago

Had the same problem, reverting to version 0.2.4 fixed it for me.

binarykitchen commented 10 years ago

Yeah could do the same but IMO that's not the solution.

jonathanrdelgado commented 10 years ago

Absolutely, just wanted to point out the issue was created between the two versions.

joaoneto commented 10 years ago

+1 Guys, another workaround:

// . . .
gulp.src(CordovaLibDir)
    .pipe(clean())
    .on('error', done)
    .on('data', function () {}) // fix end emit, listen the data
    .on('end', function () {
      console.log('END');
    });
adamayres commented 10 years ago

+1

Maxtermax commented 9 years ago

@joaoneto +1

jleppert commented 9 years ago

@peter-vilja either maintain your package or deprecate it!

peter-vilja commented 9 years ago

@jleppert it's been deprecated since Jun 25, 2014 in favor of del (https://www.npmjs.com/package/del). But if people do want to use gulp-clean instead, I could look into this.