私はgulp-group-aggregateの助けを借りてそれを行うことができました:
var groupAggregate = require("gulp-group-aggregate");
gulp.task("buildResources:js", function () {
return gulp.src(["/sourcefolder"], { base: "." })
.pipe(groupAggregate({
group: function (file) {
var extractResourceLocale = function() {
var result = file.relative.substring(0, file.relative.length - 3); // remove ".js"
var dotIndex = result.lastIndexOf(".");
return result.substring(dotIndex + 1, result.length);
}
return extractResourceLocale(file);
},
aggregate: function (group, files) {
var filesArray = [];
for (var i = 0; i < files.length; i++) {
filesArray[i] = files[i].relative;
}
var bundlePath = "bundles/result." + group + ".js";
gulp.src(filesArray)
.pipe(concat(bundlePath))
.pipe(uglify())
.pipe(gulp.dest("."));
return {
path: ".",
contents: null
}
}
}))
.pipe(gulp.dest("."));
});