例如,我想遍历所有 src 文件并将每个文件移动到以文件名本身命名的文件夹中。
来自:
hello.js
omg.js
到:
hello/
hello.js
omg/
omg.js
我有这个任务:
gulp.src('/*.js')
.pipe(gulp.dest('/' + filename here.......));
我如何实现这一目标?
最佳答案
gulp.task('pack', function () {
return gulp.src('temp/**/*.js')
.pipe(uglify())
.pipe(rename(function (path) {
path.dirname += "/"+path.basename;
path.extname = ".min.js";
}))
.pipe(gulp.dest('./build'));
});
关于javascript - Gulp dest() 基于文件名的动态目标文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38025871/