I'm using grunt-watch
to re-build my less style sheets:
watch: {
less: {
files: ['media/less/**/*.less'],
tasks: ['less'],
options: {
atBegin: true,
spawn: false
}
}
}
But if there is a syntax error in any of the .less
files, the task just loops, trying to re-build the .less
files every second… which makes debugging fairly difficult, because the error messages scroll past very quickly.
Is there any way fix that, so grunt-watch
will only re-run the task once the .less
files have been changed again?
This is using:
grunt@0.4.2
grunt-contrib-less@0.8.3
grunt-contrib-watch@0.5.3
I think the issue you're describing is this one, which was fixed in master but hasn't yet been released (as of 2013/12/17).
Well, for debugging purposes you could do a simple envelope of the
less
task with a custom task:Then use your
myless
task in thewatch
.UPDATE:
the idea is that since any repeated call to
less
now goes through your code - you can do whatever needed to either provide a more concrete output or preven repeated calls if failing is "desired" outcome and should fail, but not loop.UPDATE 2:
Something like this: