新的grunt - 警告:任务“concat,uglify”未找到 [英] new to grunt - warning: task "concat, uglify" not found
问题描述
grunt
时,出现以下错误:警告:未找到任务concat,uglify。使用--force继续。因错误而中止。
我一直在环顾四周,似乎无法弄清楚。我的文件如下: Gruntfile.js:
模块.exports = function(grunt){
// 1.所有配置都在这里
grunt.initConfig({
pkg:grunt.file.readJSON('package.json' ),
concat:{
dist:{
src:[
'js / libs / *。js',// All JS in libs文件夹
'js / controls.js',//这个特定文件
],
dest:'dist / built.js',
}
} ,
uglify:{
build:{
src:'js / build / production.js',
dest:'js / build / production.min。 js',
}
},
});
// 3.我们告诉Grunt我们打算使用这个插件。
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
// 4.当我们在终端输入'grunt'时告诉Grunt该做什么。
grunt.registerTask('default',['concat,uglify']);
};
package.json:
{
name:grunt_libsass_example-project,
version:0.1.0,
devDependencies:{
grunt:〜0.4.1,
grunt-contrib-concat:^ 0.5.1,
grunt-contrib-uglify:^ 0.9.1
}
}
registerTask任务列表的一个字符串。它应该是逗号分隔的字符串列表,如:
grunt.registerTask('default',['concat','uglify ]);
你正在寻找一个名为'concat,uglify'的任务。 p>
As the title says I'm new to Grunt. I am following a tutorial located at: http://24ways.org/2013/grunt-is-not-weird-and-hard/. It is an older tutorial but most seems to work the same. I have installed "grunt-contrib-concat" and "grunt-contrib-uglify" and can run both individually. But when I run grunt
, I get the following error: Warning: Task "concat, uglify" not found. Use --force to continue. Aborted due to errors.
I've been looking around and can't seem to figure it out. My files are as follows:
Gruntfile.js:
module.exports = function(grunt) {
// 1. All configuration goes here
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
dist: {
src: [
'js/libs/*.js', // All JS in the libs folder
'js/controls.js', // This specific file
],
dest: 'dist/built.js',
}
},
uglify: {
build: {
src: 'js/build/production.js',
dest: 'js/build/production.min.js',
}
},
});
// 3. Where we tell Grunt we plan to use this plug-in.
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
// 4. Where we tell Grunt what to do when we type 'grunt' into the terminal.
grunt.registerTask('default', ['concat, uglify']);
};
package.json:
{
"name": "grunt_libsass_example-project",
"version": "0.1.0",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-uglify": "^0.9.1"
}
}
Your passing in only one string for the registerTask task list. It should be a comma separated list of strings like:
grunt.registerTask('default', ['concat', 'uglify']);
You're getting that error because it's looking for a task named 'concat, uglify'.
这篇关于新的grunt - 警告:任务“concat,uglify”未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!