我正在构建两个 gulp 流来压缩系统的两个区域的模板,然后我正在使用gulp-merge
并将gulp-concat
它们合并到一个文件中。
奇怪的是,切换两个流的顺序会导致concat()
返回一个空流(因此没有最终文件)。
更奇怪的是,在另一台开发机器(两个窗口)上,相反的顺序是工作顺序!!
var portalTemplates = gulp.src(input)
.pipe(templateCache('portal', { module: 'common.templates', standalone: true, root: templatePathPrefix + '/' + portalName + '/angular' }));
var sharedTemplates = gulp.src(sharedFiles.templates)
.pipe(templateCache('shared', { module: 'common.templates', root: templatePathPrefix + '/_shared/angular' }));
gulpMerge(sharedTemplates, portalTemplates)
.pipe(gulpTap(function (f) {
console.log(f.path, ' => ', f.contents.length);
}))
.pipe(concat('merged'))
.pipe(gulpTap(function (f) {
console.log(f.path, ' => ', f.contents.length);
}))
.pipe(gulp.dest(output.folder));
为了说明这个问题,我console.log
在 concat 之前和之后添加了这些 s。
在这个订单上我得到
shared => <length>
逆序(即gulpMerge(portalTemplates, sharedTemplates)
)
portal => <length>
shared => <length>
merged => <length>
很感谢任何形式的帮助!