Closed githoniel closed 7 years ago
The file that is passed into gulp.src
is used to set the include
and out
parameters of the build. However, if those parameters exist in your build config, it ignores them and uses whatever you supply. I don't know exactly how your project and r.js build options are set up, but assuming all of your modules are in the root of your source tree you could do something like this:
for (let moduleName in buildConfig) {
gulp.task("rjs:"+moduleName, function() {
return gulp.src([moduleName + '.js'])
.pipe(requirejsOptimize({
baseUrl: "./",
mainConfigFile: "main.js",
preserveLicenseComments: !1,
generateSourceMaps: !1,
optimizeCss: "none",
writeBuildTxt: !1
}))
.pipe(gulp.dest("./dist"));
});
taskList.push('rjs:'+moduleName);
}
my build file is like
as it's use to optimize a module and will generate one file
What does gulp.src use for ? And How can I remove it? If the file path is null/undefied or no file path , it's broken. If the path is the whole app , it will scan all file and optimizing all file and waste a lot of time. So I have to add a empty.js to make it run