我正在尝试使用 grunt-newer 来监视文件夹中的文件,如果有任何更改,则触发自定义任务。
我的 Gruntfile.js 中有这样的东西:
grunt.initConfig({
watch: {
widgets: {
files: "/somepath/*.js",
tasks: ['newer:mycustomtask']
}
}
});
grunt.registerTask("mycustomtask", ["description of my task"], function() {
console.log("me has been triggered");
});
每当我运行“grunt watch”时,我都会得到这样的输出:
Running "watch" task
Waiting...
File "/somepath/WidgetA.js" changed.
Running "newer:mycustomtask" (newer) task
Fatal error: The "newer" prefix is not supported for aliases
我用谷歌搜索但没有找到任何相关信息。任何人都知道我怎么能实现这个?我现在需要在我的“自定义任务”中更改哪些文件
最佳答案
如果您引用未安装或未配置的任务(内部监视或并发,例如),您会收到此错误输出。
当您复制粘贴来自不同项目的 watch 配置时,这种情况经常发生。
关于javascript - 将 Grunt newer 与自定义任务一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32629168/