[英]new to grunt - warning: task "concat, uglify" not found
正如標題所說,我是 Grunt 的新手。 我正在關注位於: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.
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']);
};
包.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”的任務。
我不得不跑:
npm install grunt-contrib-uglify --save-dev
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.