我想分割成小片大gruntfile来到这些文章: https://github.com/firstandthird/load-grunt-config http://ericnish.io/blog/how-to-neatly-separate-grunt-files/ 但是,似乎我失去了一些东西明显。当我发出“grunt testtask”时,找不到任务。显然,我正在做一些非常错误的事情,但我不明白。 这里的文件的内容,精简尽可能:负载咕噜-Config中找不到目标任务
gruntfile.js:
module.exports = function(grunt) {
var path = require('path');
require('load-grunt-config')(grunt, {
configPath: path.join(process.cwd(), 'grunt3'),
init: true
});
};
grunt3/testtask.js:
module.exports = {
copy: {
main:
{
files:
[{
src: "test1.txt",
dest: "test2.txt"
}]
}
}
};
I added an aliases file:
module.exports = {
'default': [],
'mytesttask': [
'testtask'
]
};
默认被发现。对于mytesttalk,我会得到“testtask not found”。 不应该aliases.js为文件名(testtask)或“复制”(我也尝试使用'复制'作为目标任务)做一个registerTask? 根据--config-debug,有一个名为“testtask”的配置对象。 我在这里错过了什么?
谢谢。
附录:在同一主题上发现了这个非常简单和直接的文章,它展示了如何进一步简化。再一次,它不起作用。未找到在别名中指定的任务。例如'mytesttask':['testtask'] - > testtask没有找到,尽管有一个grunt/testtask.js文件包含来自原始gruntfile的任务。我错过了什么?