grunt icon indicating copy to clipboard operation
grunt copied to clipboard

watch task always stopping: No possibility to make it retry after some seconds?

Open Blackbam opened this issue 6 years ago • 0 comments

This is especially a problem because it happens when I am typing in the IDE. The issue was also asked on SO but no answers till now: https://stackoverflow.com/questions/57992153/grunt-watch-always-stops-watching-after-fatal-errors-how-to-make-it-retry-af

Within some project I use Grunt for tasks like SASS compilation and so on. Basically it works like a charm, but as long as I am typing within the SASS files obviously sometimes an error occurs as I am not finished.

The watch task of my Gruntfile is like this:

// watch files
watch: {
    sass: {
        files: ['web/var/static/**/*.scss','web/var/static/lib/**','web/var/static/js/*.js'],
        tasks: ['default']
    }
},

I start it with grunt watch in the cli.

Sample error in Grunt log:

Completed in 1.968s at Wed Sep 18 2019 13:43:01 GMT+0200 (Central European Summer Time) - Waiting...
>> File "web/var/static/sass/layout/footer.scss" changed.
Running "sass:dist" (sass) task

Running "autoprefixer:dist" (autoprefixer) task
>> 4 autoprefixed stylesheets created.

Running "cssmin:dist" (cssmin) task
>> 4 files created. 706.54 kB → 598.46 kB

Running "concat:dist" (concat) task

Running "uglify:main" (uglify) task

Done.
Completed in 1.769s at Wed Sep 18 2019 13:43:25 GMT+0200 (Central European Summer Time) - Waiting...
>> File "web/var/static/sass/layout/footer.scss" changed.
Running "sass:dist" (sass) task
Fatal error: Error: property "ul" must be followed by a ':'
        on line 52 of web/var/static/sass/layout/footer.scss
        from line 13 of web/var/static/sass/main.scss
>>     ul

   ----^

I always have to re-run the task if this happens because grunt stops watching. That means:

  • open the console window
  • stop the current task
  • start the task again
  • change a file

This is really slowing down.

Has anybody had a similar problem? How to make grunt retry automatically after an error as soon as a new file changes happens?

Blackbam avatar Sep 25 '19 07:09 Blackbam