sindresorhus / gulp-filter

Filter files in a `vinyl` stream
MIT License
315 stars 37 forks source link

Passthrough restoration causing debug count message to show 0 #56

Closed Sawtaytoes closed 7 years ago

Sawtaytoes commented 8 years ago

This same issue happens with gulp-filter:

ops.copy = function(taskName, src, dest) {
    var bowerComponents = $.filter(['**/*', '!' + paths.bower.src + '**/*'], {restore: true, passthrough: false}),
        stream;

    stream = gulp.src(src, {base: process.cwd()})
        .pipe($.plumber({errorHandler: ops.showError}))
        .pipe(bowerComponents)
        .pipe($.rename(function (filePath) {
            filePath.dirname = '.';
        }))
        .pipe($.newer(dest))
        .pipe($.debug({title: taskName}))
        .pipe(gulp.dest(dest));

    bowerComponents.restore
        .pipe($.rename(function (filePath) {
            filePath.dirname = filePath.dirname.split(path.sep)[1];
        }))
        .pipe($.newer(dest))
        .pipe($.debug({title: taskName}))
        .pipe(gulp.dest(dest));

    return stream;
};

Shows:

$ gulp font.build
Gulp loaded in 1.582 seconds
[02:23:23] Using gulpfile gulpfile.js
[02:23:23] Starting 'font.build'...
[02:23:23] font.build font-awesome\fontawesome-webfont.eot
[02:23:23] font.build font-awesome\fontawesome-webfont.svg
[02:23:23] font.build font-awesome\fontawesome-webfont.ttf
[02:23:23] font.build font-awesome\fontawesome-webfont.woff
[02:23:23] font.build font-awesome\fontawesome-webfont.woff2
[02:23:23] font.build font-awesome\FontAwesome.otf
[02:23:23] font.build slick.js\slick.eot
[02:23:23] font.build slick.js\slick.svg
[02:23:23] font.build slick.js\slick.ttf
[02:23:23] font.build slick.js\slick.woff
[02:23:23] font.build 0 items
[02:23:23] Finished 'font.build' after 51 ms

It's showing 0 items on the filtered restore even though the debug messages are still showing up. Does it have to do with what's being returned?

nfroidure commented 8 years ago

If this is an issue, i'm not sure it is comparable to the gulp-if one. Also, since you're using taskname for your both debugs, it is hard to interpret the output you provided.

Sawtaytoes commented 8 years ago

All of the fonts in my paste are from Bower so they're going to be in the second stream, the restore.