gulp-concat icon indicating copy to clipboard operation
gulp-concat copied to clipboard

incorrect work with merge streams plugins

Open tamtakoe opened this issue 9 years ago • 2 comments

Windows, node.js v 0.12.2

File structure:

test1
|- script1.js
|- script2.js
|- ...
test2
...
test5

gulpfile.js:

gulp.task('test', function() {
    var streamsArr = [];

    for (var stream, i = 1; i < 5; i++) {
        stream = gulp.src(path.join(__dirname, 'test' + i, '**/*'))
            .pipe(through.obj(function(file, enc, callback) {
                setTimeout(function() {
                    callback(null, file);

                }, Math.ceil(Math.random()*100));
            }))
            .pipe(require('gulp-concat')('script.js'))
            .on('end', (function(i) {
                console.log('end of the stream ' + i);
            }).bind(null, i));

        streamsArr.push(stream);
    }

    require('gulp-merge')(streamsArr) //or stream-series, or merge-stream, etc.
        .pipe(through.obj(function(file, enc, callback){
            console.log('merged stream transform:', path.relative(__dirname, file.path));

            callback(null, file);

        }, function(callback) {
            console.log('merged stream flush');

            callback();
        }))
        .on('end', function() {
            console.log('end of the merged stream');
        });
});

console:

end of the stream 4
end of the stream 3
merged stream transform: test1\script.js
end of the stream 1
merged stream transform: test2\script.js
end of the stream 2

Somehow, part of a stream is lost. Also did not work flush and end event of merged stream.

tamtakoe avatar Apr 08 '15 15:04 tamtakoe

This looks like: https://github.com/wearefractal/gulp-concat/issues/94

insidewhy avatar May 13 '15 08:05 insidewhy

Is this still an issue with the latest versions of everything? I think this was fixed in our underlying sourcemap module

yocontra avatar Dec 10 '15 04:12 yocontra