0
的文件的相对路径我想使用gulp将src集合中的所有HTML从父目录复制并粘贴到子目录,但要保留它们路径gulp丢失从gulp.src(Array)到gulp.dest
Project
+-- /Development
| +- gulpfile.js
|
+-- /Source
+- /ComponentA
| +- /DirA
| +- fileA.html
|
+- /ComponentB
| +- /DirB
| +- fileB.html
|
+- /ComponentC
+- /DirC
+- fileC.html
我需要吞掉所有的HTML文件复制到相对路径为发展/的public_html
Project
+-- /Development
+- gulpfile.js
|
+- /public_html
+- /ComponentA
| +- /DirA
| +- fileA.html
|
+- /ComponentC
+- /DirC
+- fileC.html
我一饮而尽任务
gulp.task('copyHTMLwrong', function() {
return gulp.src([
'../Source/ComponentA/**/*.html',
'../Source/ComponentC/**/*.html'
])
.pipe(gulp.dest('public_html'));
});
,但我得到(松路):
Project
+-- /Development
+- gulpfile.js
|
+- /public_html
+- fileA.html
+- fileC.html
PS:我知道,如果我使用 '源/ **/* HTML',将正确地复制所有文件,我敢肯定,我也可以使用删除ComponentC!,但我需要在我的gulp.src上定义每个组件,因此我可以为每个网站编译一组文件。
gulp.task('copyHTMLnotUseful', function() {
return gulp.src([
'../Source/**.*.html',
'!../Source/ComponentB/**/*.html'
])
.pipe(gulp.dest('public_html'));
});
我试过设置CWD或基地,但也不能工作。
感谢