0
我有一口任務的問題:咕嘟咕嘟具有文件夾被命名爲喜歡的文件
gulp.task('css-dependencies', function() {
return gulp.src(['bower_components/**/*.css','!bower_components/**/*.min.css'])
.pipe(rename({dirname: './css'}))
.pipe(gulp.dest('./'));
});
但是我想用animate.css
並通過亭子加把它夾在工作正常的所有其他部件,所謂animate.css
:
Project
|
+-- bower_components
|
+-- animate.css
|
+--animate.css
+--animate.min.css (etc)
導致的重命名任務一飲而盡失敗:
Error: EISDIR: illegal operation on a directory, open ‘~/css/animate.css' at Error (native)
除了特別豁免之外,我該如何解決這個問題?
您需要粘貼不僅僅是代碼工作正常,你已經嘗試的代碼。 – catssay
@catssay我的代碼不適用於我描述的情況。我可以爲它設置一個特定的用例,這將起作用,但不可擴展。由於src是一個模式匹配(我相信)我不能想辦法只匹配文件,而不是目錄。 – Rudiger
我已經尋找吞的源代碼和描繪路徑的解釋,這是一個所謂的模塊[圓頂封裝體親本(https://github.com/es128/glob-parent)時,'bower_components/**/* .css'會給你的'bower_components'不bower_components/*',所以它實際上是在'歸還所有css文件bower_components'不'bower_components/*',如果你想在完全相同的文件'bower_components/*'父路徑,你需要像'bower_components/\ * */*。css'一樣轉義'*'。你可以在gulp項目中引發一個問題。 – catssay