[英]Grunt Watch repeatedly showing “Warning: must provide pattern”
我无法配置Grunt来查看我的项目文件,重建和更新连接服务器中托管的页面。 如果我运行任何构建任务然后'watch'
作为组合任务的一部分,那么'watch'
似乎陷入循环,无休止地打印消息。
Running "watch" task
Waiting...
Warning: must provide pattern
如果我只是运行$ grunt watch
,它会愉快地观察我的源文件并根据需要编译/构建。
我认为相关的任务配置是这些:
watch: {
html: {
files: [ '<%= site.partials %>', '<%= site.layouts %>', '<%= site.pages %>' ],
tasks: [ 'html' ]
},
sass: {
files: [ '<%= site.src %>sass/*.scss' ],
tasks: [ 'styles' ]
}
},
// development server
connect: {
options: {
port: 8080,
livereload: 35729,
hostname: 'localhost',
},
dev: {
options: {
directory: 'build',
}
}
},
和任务定义:
grunt.registerTask( 'build', [ 'styles', 'html', ] );
grunt.registerTask( 'default', [ 'build','connect:dev', 'watch' ] );
'styles'
和'html'
任务运行grunt-sass和汇编。 如上所述,运行任何这些任务,甚至自己'watch'
产生预期的结果。 这表明我的配置对象已正确定义site.partials
, site.dest
等。 问题只发生在我运行任何任务然后'watch'
,就像在默认任务中一样。
当我编辑我的Gruntfile并将一个字段(应该有一个文件模式)留空时,我刚遇到类似的问题。
检查Gruntfile以查找空文件字段。
在我的具体例子中:
wiredep: {
options: {
overrides: {
"jquery-ui": {
"main": [
"jquery-ui.js",
"themes/base/jquery-ui.css",
""
]
}
}
}
}
注意上面的空字符串。 这产生了一个与你非常相似的错误。 不幸的是,Grunt似乎没有告诉你错误在哪里 。 您只需手动扫描Gruntfile即可找到错误。
连接:开发是问题所在。 删除它,它应该工作正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.