0

正如標題所說,我是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.我一直在環顧四周,似乎無法弄清楚。我的文件如下:新來的咕嚕 - 警告:任務「concat,uglify」找不到

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" 
    } 
} 

回答

3

你的只有一個弦通的registerTask任務列表。這應該是一個逗號分隔像字符串列表:

grunt.registerTask('default', ['concat', 'uglify']); 

你得到錯誤,因爲它在尋找一個名爲任務「CONCAT,醜化」。

+0

完美。感謝您及時的回覆。清除它。 – djlotus