我试图用grunt-contrib-less和grunt-contrib-watch设置grunt-notify.一般情况下,这种方法运行良好,但是当grunt-less成功执行时,我无法通知grunt-notify通知我.
如果有人对如何设置或调试有任何见解,很高兴有任何输入.
完整信息:
我已经设置了grunt-notify,只要少用手表运行就会触发.当较少的任务失败时,这很有效.给我一个很棒的弹出错误:

作为参考,这是控制台输出:

如果不太成功,我没有收到任何通知.我想收到通知,但无法弄清楚如何启用此功能.
当成功较少时,这是控制台输出:

这是我使用的GruntFile:
module.exports = function(grunt) {
grunt.initConfig({
less: {
development: {
options: {
compress: true
},
files: {
"FILE.css": "FILE2.less"
}
}
},
watch: {
less: {
files: '**/*.less',
tasks: ['less', 'notify_hooks']
}
},
notify_hooks: {
options: {
message: "MESSAGE"
}
}
});
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-notify');
grunt.registerTask("default", ['less']);
};
Run Code Online (Sandbox Code Playgroud)
Grunt通知:https://github.com/dylang/grunt-notify很棒.但是,它似乎有点受限.据我所知,我需要预先生成所有消息.所以第一个问题是如何生成通知?
接下来,似乎grunt通知触发器基于某些任务的错误或成功.我猜基于std in/out/err?这种情况发生故障的问题是,如果某些任务不使用这些.如果存在编译错误,grunt指南针不使用stderr.那么如何在出现错误时运行grunt notify?然后这导致下一个问题.如何从grunt任务中获取控制台输出或stderr?