gulp dest()dynamic目标文件夹根据文件名

我想遍历所有的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')); });