[英]How do I pass to other gulp tasks from gulp watch
I'm pretty new to gulp, here's what's happening 我很新,这就是发生的事情
I did have: 我确实有:
gulp.watch(config.build.sass + '/**/*.scss', ['sass-dev']);
But this didn't catch any new files, so after reading the docs I need to have: 但这没有捕获任何新文件,因此在阅读文档后,我需要具备以下条件:
gulp.watch({
glob: config.build.sass + '/**/*.scss',
emit: 'all'
}, ['sass-dev']);
But this throws an error: Object #<Object> has no method 'indexOf'
as the last part is incorrect. 但这会引发错误:
Object #<Object> has no method 'indexOf'
因为最后一部分不正确。
Can anyone tell me the syntax I need to run my sass-dev
task on anything emitted from watch? 谁能告诉我在watch发出的任何内容上运行
sass-dev
任务所需的语法?
Have you tried this: 您是否尝试过:
gulp.watch(config.build.sass + '/**/*.scss', {emit: 'all'}, ['sass-dev']);
? ?
Your first example seems fine. 您的第一个示例似乎不错。 No need to use glob option.
无需使用glob选项。 But it depends on what
config.build.sass
is. 但这取决于
config.build.sass
是什么。
gulp.watch(config.build.sass + '/**/*.scss', ['sass-dev']);
If you'd like to use glob
option, try this. 如果您想使用
glob
选项,请尝试此操作。
gulp.watch(config.build.sass + '/**/*.scss', { some_option: value }, ['sass-dev']);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.