This question already has an answer here:
这个问题在这里已有答案:
- Can you remove a folder structure when copying files in gulp? 2 answers
在gulp中复制文件时可以删除文件夹结构吗? 2个答案
How do I move files using Gulp from different folders in my src directory into the dist folder without keeping the directory structure from src.
如何使用Gulp将文件从我的src目录中的不同文件夹移动到dist文件夹中,而不保留src中的目录结构。
For eg:
var sourceFiles = [
"src/folder1/test.js",
"src/folder1/test1.js"
];
should be moved to the dist folder i.e:
应该移到dist文件夹,即:
dist/test.js
dist/test1.js
Using something like this:
使用这样的东西:
gulp.task("moveFiles",function(){
return gulp.src(sourceFiles, {base: "src"})
.pipe(gulp.dest("dist"));
});
moves it to dist/folder1 ie
将它移动到dist / folder1即
dist/folder1/test.js
dist/folder1/test1.js
1 个解决方案
#1
0
I ended up solving the issue without using the base option:
我最终解决了这个问题而没有使用基本选项:
gulp.task("moveFiles",function(){
return gulp.src(sourceFiles)
.pipe(gulp.dest("dist"));
});
#1
0
I ended up solving the issue without using the base option:
我最终解决了这个问题而没有使用基本选项:
gulp.task("moveFiles",function(){
return gulp.src(sourceFiles)
.pipe(gulp.dest("dist"));
});