纠错后Grunt手表没有少跑

Mat*_*agh 13 javascript gruntjs grunt-contrib-watch

我有一个问题,Grunt Watch目前没有在编译错误纠正后重新运行任务.

我收到错误消息,但在纠正错误之后,grunt说文件已经更改,但在该点之后没有运行任务.

Grunt文件:

watch: {
        less: {
            files: ['public/assets/less/**/*.less'],
            tasks: ['css'],
            options: {
                atBegin: true,
                nospawn: true
            }
        },
        scripts: {
            files: [
                'public/assets/js/homepage.js'
            ],
            tasks: ['jsApp'],
            options: {
                nospawn: true,
            }
        }
    },
Run Code Online (Sandbox Code Playgroud)

错误日志:

>> ParseError: Unrecognised input in public/assets/less/template.less on line 114, column 31:
>> 114         @media screen and (max-width: 767px) {
>> 115             left: 0;
Warning: Error compiling public/assets/less/main.less
// ----- Corrected the file here, saved again -----
>> File "public/assets/less/template.less" changed.
Run Code Online (Sandbox Code Playgroud)

文件结束.在此之后没有任何事情.

Oli*_*Oli 2

这是 grunt-contrib-watch 包 spawn 函数的问题,您可能想要删除 nospawn。如果您还没有尝试过,您可能想尝试 grunt watch 1.0.0 版本。

这个问题之前已经讨论过 https://github.com/gruntjs/grunt-contrib-watch/issues/58

另外,请注意文档:

不生成任务运行可能会使手表更容易出现故障,因此请根据需要使用。

在你的位置我会首先升级,看看我有最新版本的 grunt、grunt watch 和 grunt less。如果这不能解决问题,我就让它正常生成。