[英]How to ignore node_modules directory from gulp:watch?
I have a gulp script that watches for code changes in all javascript files
. 我有一个gulp脚本,监视所有
javascript files
代码更改。 It looks like this: 看起来像这样:
gulp.watch(['./**/*.jsx', './**/*.js'], ['build:react']);
So, it watches for all .js
and .jsx
files from root directory, but I want to ignore node_modules
directory. 因此,它从根目录中
.jsx
所有.js
和.jsx
文件,但我想忽略node_modules
目录。 How can I do that ? 我怎样才能做到这一点 ?
You ca use gulp unwatch
This removes the folder specified from your pipe. 您可以使用
gulp unwatch
这将从管道中删除指定的文件夹。 However, it's generally a good idea to have a source
folder that gulp watches instead of the project root folder (then the .git
directory and all sorts will be caught up in your task. 但是,通常最好有一个gulp监视的
source
文件夹,而不是项目根文件夹(然后, .git
目录和所有各种内容都将落入您的任务中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.