本文介紹了如何 Gulp-Watch 多個文件?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
我有這樣的事情:
gulp.task('default', ['css', 'browser-sync'] , function() {
gulp.watch(['sass/**/*.scss', 'layouts/*.css'], function() {
gulp.run('css');
});
});
但它不起作用,因為它會監視兩個目錄,即 sass 和 layouts 目錄以進行更改.
but it does not work, because it watches two directories, the sass and the layouts directory for changes.
如何讓它工作,以便 gulp 監視這些目錄中發生的任何事情?
How do I make it work, so that gulp watches anything that happens inside those directories?
推薦答案
gulp.task('default', ['css', 'browser-sync'] , function() {
gulp.watch(['sass/**/*.scss', 'layouts/**/*.css'], ['css']);
});
sass/**/*.scss
和 layouts/**/*.css
將監視每個目錄和子目錄對 .scss<的任何更改/code> 和
.css
文件更改.如果您想將其更改為 any 文件,請在最后一位 *.*
sass/**/*.scss
and layouts/**/*.css
will watch every directory and subdirectory for any changes to .scss
and .css
files that change. If you want to change that to any file make the last bit *.*
這篇關于如何 Gulp-Watch 多個文件?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!