我有一个对象数组,长得像下面这样。
var bundles = [
{
src: 'js/my-component/*.js',
bundleName: 'my-component.js'
},
{
src: 'js/my-other-component/*.js',
bundleName: 'my-other-component.js'
}
]
我希望gulp任务能够处理/合并数组中的每个条目,但似乎无法正常工作。
gulp.task('bundlejs', function(){
return bundles.forEach(function(obj){
return gulp.src(obj.src)
.pipe(concat(obj.bundleName))
.pipe(gulp.dest('js/_bundles'))
});
});