2016-08-28 42 views
1

虽然在代码中似乎都是正确的,但我收到了错误。有人可以帮忙吗?grunt uglify显示错误

gruntfile.js

module.exports = function(grunt) { 

    // Project configuration. 
    grunt.initConfig({ 

     //Setting up some base links 
     meta: { 
      basePath: '../' 
     }, 

     //Reading package.json file 
     pkg: grunt.file.readJSON('package.json'), 

     // Concat Configuration 
     concat: { 
      options: { 
       separator: ';' 
      }, 
      dist: { 
       src: ['<%= meta.basePath %>scripts/*.js'], 
       dest: '<%= meta.basePath %>scripts/concated.js' 
      } 
     }, 

     // Uglify Configuration 
      uglify: { 
       build: { 
       src: ['<%= meta.basePath %>scripts/concated.js'], 
       dest: '<%= meta.basePath %>scripts/uglify.js' 
       } 
      } 
    }); 


    // These plugins provide necessary tasks. 
    grunt.loadNpmTasks('grunt-contrib-concat','grunt-contrib-uglify'); 

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

}; 

错误

enter image description here

已经看到了链接:

grunt uglify task failing
new to grunt - warning: task "concat, uglify" not found

但是,“grunt concat”运行良好并提供结果。没有问题。但这种丑化似乎造成了很大的痛苦。

+0

悲哀!没有人帮助我? – Deadpool

回答

0

try this excerpt from http://gruntjs.com/configuring-task

uglify: { 
    static_mappings: { 
     // Because these src-dest file mappings are manually specified, every 
     // time a new file is added or removed, the Gruntfile has to be updated. 
     files: [ 
      { src: 'lib/a.js', dest: 'build/a.min.js' }, 
      { src: 'lib/b.js', dest: 'build/b.min.js' }, 
      { src: 'lib/subdir/c.js', dest: 'build/subdir/c.min.js' }, 
      { src: 'lib/subdir/d.js', dest: 'build/subdir/d.min.js' }, 
     ] 
    } 
} 
+0

没有工作兄弟! – Deadpool