Grunt JSHint多任务问题

时间:2015-05-04 13:23:14

标签: javascript gruntjs

我在设置JSHint以运行多个任务时遇到问题。这就是我所拥有的:

 jshint: {
      app: {
        files: [
            'web/**/*.js',
            '!web/app.js',
            '!web/lib/**',
            '!web/build/**'
        ],
        options: {
            // Just let the templates do whatever they want when compiled
            ignores: ['web/templates/*.js'],
            // options here to override JSHint defaults
            loopfunc: true,
            newcap: false,
            reporter: require('jshint-stylish'),
            globals: {
                jQuery: true,
                gadget: true
            }
        }
      },
      test: {
        files: [
            'web/**/*.js',
            '!web/app.js',
            '!web/lib/**',
            '!web/build/**'
        ],
        options: {
            // just let the templates do whatever they want when compiled
            ignores: ['web/templates/*.js'],
            reporter: require('jshint-stylish'),
            jshintrc: '.jshintrc'
        }
      }

 }

当我尝试运行grunt jshint:appgrunt jshint:test时,我得到的错误是其中任何一个都没有任务。

如果您发现我遗漏的任何内容,请感谢您的帮助。

1 个答案:

答案 0 :(得分:2)

我认为你需要添加

grunt.loadNpmTasks('grunt-contrib-jshint');

到您的grunt文件