I'm having trouble setting up Grunt to view project files, restore and refresh a page hosted on a connection server. If I run any build tasks and then 'watch' as part of a combined task, 'watch' seems to get stuck in a loop, endlessly printing a message.
Running "watch" task Waiting... Warning: must provide pattern
If instead I just ran $ grunt watch , it will happily watch my source files and compile / build as needed.
I think the corresponding task configurations are as follows:
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', } } },
and task definitions:
grunt.registerTask( 'build', [ 'styles', 'html', ] ); grunt.registerTask( 'default', [ 'build','connect:dev', 'watch' ] );
The 'styles' and 'html' tasks run grunt-sass and compile. As stated above, completing any of these tasks or even 'watch' alone gives the expected results. This suggests that my configuration object has site.partials , site.dest , etc. The problem occurs only when performing any task, and then 'watch' , as in the default task.