2015-04-17 43 views
1

我正在遞歸刪除目錄中的所有內容(除了一個文件),但保留文件夾本身。我已經寫了這個任務這樣做:以遞歸方式刪除文件夾的內容,但保留文件夾

gulp.task('clean:documentation', function() { 
    del([ 
     'documentation.typography/**', 
     '!documentation.typography/.gitignore' 
    ]); 
}); 

不幸的是它刪除整個文件夾。這項任務有什麼問題?我如何更新,以便除去documentation.typography中的所有內容,.gitignore文件除外?

+0

啓用option.dot? https://github.com/gulpjs/gulp/issues/932 – w00d

回答

3

解決的辦法是改變水珠:

gulp.task('clean:documentation', function() { 
    del([ 
     'documentation.typography/**/*', 
     '!documentation.typography/.gitignore' 
    ]); 
}); 
相關問題