grunt 新手 - 警告:找不到任务 "concat, uglify"
new to grunt - warning: task "concat, uglify" not found
正如标题所说,我是 G运行t 的新手。我正在关注位于 http://24ways.org/2013/grunt-is-not-weird-and-hard/ 的教程。这是一个较旧的教程,但大多数似乎都一样。我已经安装了 "grunt-contrib-concat" 和 "grunt-contrib-uglify",并且可以单独安装 运行。但是当我 运行 grunt
时,我得到以下错误: Warning: Task "concat, uglify" not found. Use --force to continue. Aborted due to errors.
我一直在四处寻找,似乎无法弄清楚。我的文件如下:
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"
}
}
您只为 registerTask 任务列表传入了一个字符串。它应该是逗号分隔的字符串列表,例如:
grunt.registerTask('default', ['concat', 'uglify']);
您收到该错误是因为它正在寻找名为 'concat, uglify' 的任务。
正如标题所说,我是 G运行t 的新手。我正在关注位于 http://24ways.org/2013/grunt-is-not-weird-and-hard/ 的教程。这是一个较旧的教程,但大多数似乎都一样。我已经安装了 "grunt-contrib-concat" 和 "grunt-contrib-uglify",并且可以单独安装 运行。但是当我 运行 grunt
时,我得到以下错误: Warning: Task "concat, uglify" not found. Use --force to continue. Aborted due to errors.
我一直在四处寻找,似乎无法弄清楚。我的文件如下:
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"
}
}
您只为 registerTask 任务列表传入了一个字符串。它应该是逗号分隔的字符串列表,例如:
grunt.registerTask('default', ['concat', 'uglify']);
您收到该错误是因为它正在寻找名为 'concat, uglify' 的任务。