Gruntjs 任务';最小值';找不到
我刚刚为我的项目设置了Grunt,我正在尝试运行Gruntjs 任务';最小值';找不到,gruntjs,Gruntjs,我刚刚为我的项目设置了Grunt,我正在尝试运行min任务,但我得到了错误: 找不到任务“min” 这是我的grunfile.js: module.exports = function(grunt) { // Project configuration. grunt.initConfig({ min: { dist: { src: "calculator/add.js", dest: "add.min.js"
min
任务,但我得到了错误:
找不到任务“min”
这是我的grunfile.js
:
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
min: {
dist: {
src: "calculator/add.js",
dest: "add.min.js"
}
}
});
};
这里可能出了什么问题?谢谢 您需要将包含任务的npm模块加载到grunt中。更新GrunFile,使其看起来像下面的示例 请注意,您需要具有要加载的npm模块的正确名称。尽管grunt任务可以称为
min
,但npm模块可能不是这样。我在下面的示例文件中引用了grunt-example-min
,因此请确保将其更新为正确的名称
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
min: {
dist: {
src: "calculator/add.js",
dest: "add.min.js"
}
}
});
grunt.loadNpmTasks('grunt-example-min');
grunt.registerTask('default',['min']);
};
它不应该被称为
Gruntfile
而不是Gruntfile.js
?这个文件是在我安装grunt时创建的,所以我想它的命名是正确的,我不确定你认为哪个插件提供了min任务。也许这会有用:谢谢,这很有用!