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或基地,但也不能工作。
感謝