【发布时间】:2016-04-11 02:51:21
【问题描述】:
我有来自 grunt-contrib-watch 的带有“watch”任务的 grunt 项目,我想将它重命名为“delta”,并在我自己的“watch”任务的上下文中调用它另一个我的任务。我也在使用 load-grunt-config。我的配置:
package.json
{
"author": "Boris",
"name": "my-project",
"version": "0.0.0",
"dependencies": {},
"repository": {},
"devDependencies": {
"grunt-contrib-copy": "^0.8.2",
"grunt-contrib-watch": "^0.6.1",
"load-grunt-config": "^0.19.1"
}
}
Gruntfile.js
module.exports = function(grunt) {
require('load-grunt-config')(grunt);
grunt.renameTask('watch', 'delta');
}
grunt/aliases.js
module.exports = {
watch: [
'copy',
'delta'
]
};
grunt/watch.js
module.exports = {
options: {
livereload: true
},
js: {
files: [
'<%= app_files.js %>'
],
tasks: ['copy']
}
}
但我有错误:
Warning: Task "watch" not found. Use --force to continue.
好像是因为
grunt.renameTask('watch', 'delta');
在配置加载之后,但另一方面我不能在之前插入这段代码,因为在配置加载之前没有声明的“监视”任务。
任何想法如何正确实现它?
【问题讨论】:
标签: gruntjs