Grunt Watch re-displays "Warning: must provide template"

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.

+5
source share
2 answers

I ran into a similar problem when I edited my Gruntfile and left the field (which should have had a file template) blank.

Check your Grunt file for an empty field.

In my specific example:

 wiredep: { options: { overrides: { "jquery-ui": { "main": [ "jquery-ui.js", "themes/base/jquery-ui.css", "" ] } } } } 

Pay attention to the empty line above. This caused an error very similar to yours. Grunt does not seem to tell you where the error is, unfortunately. You just need to manually scan the Gruntfile to find the error.

+13
source

connect: dev is the problem. Remove this and it should work fine.

-1
source

Source: https://habr.com/ru/post/1204161/


All Articles