Closed erikras closed 10 years ago
@erikras I think gulp uses object mode since each element in the stream is a vinyl object: https://github.com/wearefractal/vinyl
You'll have better luck posting to gulp issues forum.
For streams of files, gulp uses objectMode. Are you referring to a particular gulp plugin that is not using objectMode? Or are you referring to a stream of the file contents? If it's a stream of the file contents, I think you're on your own...
The problem is that exorcist is not an official gulp plugin, and apparently I don't understand node streams well enough to wrap it into a gulp plugin. Exorcist takes command line piped input. It sounds like I'd have to unwrap the vinyl object, pass it through exorcist, and then wrap it again. It seems like a common enough problem that I thought maybe someone had written one.
Thanks for your quick replies.
Aha!!! I knew this was possible. vinyl-transform to the rescue!
For posterity, this is how you wrap exorcist for gulp:
'use strict';
var gulp = require('gulp'),
browserify = require('gulp-browserify'),
transform = require('vinyl-transform'),
exorcist = require('exorcist'),
concat = require('gulp-concat');
gulp.task('browserify', function () {
gulp
.src('src/app.js')
.pipe(browserify({
debug: true
}))
.pipe(transform(function () {
return exorcist('dist/script.map');
}))
.pipe(concat('script.js'))
.pipe(gulp.dest('./dist'));
});
gulp.task('default', ['browserify']);
Greetings. Perhaps this is a stupid n00b question, but...
I've got a library, gulp, that is using through2 in normal (binary?) stream mode, and I'd like to pass my stream through another library, exorcist, which is using through2 in
objectMode
.Is there any way to reconcile these streams? Something I could pipe it through?