一路编程 -- Gruntfile.js

《一路编程》 Steven Foote 

第四章构建工具 中的 Gruntfile.js 文件的 JSHint 部分,如果按照书中所写,run  grunt 的命令的时候会出错。

此处附上完整的可以工作的 Gruntfile.js 文件,在书中的基础上,在JSHint 内部添加如下即可:

options: {
reporterOutput: ''
}

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
   concat: {
     release: {
       src: ['js/value.js', 'js/prompt.js','js/getImages.js'] , dest: 'release/main.js'
     }
   },
   copy:{
    release: {
      src: 'manifest.json',
      dest: 'release/manifest.json'
    }
   },
   jshint: {
     files: ['js/value.js', 'js/prompt.js' , 'js/getImages.js'],
     options: {
        
        reporterOutput: ''
     }
    
   },
   watch:{
       files: ['<%= jshint.files %>', 'manifest.json'],
       tasks: ['default']
   }
  });
    
    

  // Load the plugin 
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  
  // Default task(s)
  grunt.registerTask('default', ['jshint','concat','copy']);

};
原文地址:https://www.cnblogs.com/luffystory/p/9190574.html