1
私は興味深い質問が1つあります。開いているストリーム(EventStream)内のいくつかのファイルをgulp内で変更することは可能ですか?他のgulpのEventStreamの中の他のファイルを変更してください
私はそれを持っています。開いているストリームの中のあるファイルを読み込み、そのファイルを他のファイルに書きたい。私はそれをどのようにすることができますか?ありがとう。
gulp.task('handleGlobalStorage', function() {
return gulp.src('./global_storage.js')
.pipe(setEnvHostAndProxy())
.pipe(gulp.dest('./built'));
});
function setEnvHostAndProxy() {
return es.map(function(file, cb) {
var fileContent = file.contents.toString();
//some changes inside content
// if (!gutil.env.dev) return;
/* I have stuff that fetched from file and I modify it that I send it
down to pipe. But also I want to insert this stuff inside other
file. How I can do it? Should I create WritableStream of that file
and merge it ?*/
file.contents = new Buffer(fileContent);
// send the updated file down the pipe
cb(null, file);
});
}
もっと具体的にする必要があります。それ以外のファイルは既に存在するのですか、まったく新しいファイルを作成したいだけですか? '。/ built'フォルダに他のファイルを書きたいのですか? –
回答ありがとうSven。実際にファイルが存在し、インポートするだけでファイルを変更したいだけですが、メインストリームをインポートする必要があります。 – Velidan