搜索

首页  >  问答  >  正文

javascript - grunt提示缺少括号,但是没缺少括号(已解决,semicolon没百度就觉得是分号,原来是分号)

Gruntfile.js

module.exports = function(grunt){
    //任务配置
    grunt.initConfig({

        pkg:grunt.file.readJSON('package.json'),
    
        uglify:{
            //options配置允许生成的压缩文件带banner
            options:{
                stripBanners:true,
                banner:'/*! <%=pkg.name%>-<%=pkg.version%>.js.min.js <%= grunt.template.today("yyyy-mm-dd")%> */\n'
            },
            //build 配置源文件和目标文件
            build:{
                src:'src/test.js',
                dest:'build/<%=pkg.name%>-<%=pkg.version%>.js.min.js'
            }
        },

        jshint:{
            //表明要检测什么js文档的语法
            build:['Gruntfile.js','src/*.js'],
            //通过什么语法规则检查语法
            options:{
                jshintrc:'.jshintrc'
            }
            
        }

    });

    //告诉grunt将使用插件
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    //告诉grunt在终端输入grunt时需要做什么
    grunt.registerTask('default',['jshint','uglify']);
}//line 37

package.json

{
  "name": "grunt_test",
  "version": "1.0.0",
  "devDependencies": {
    "grunt": "^1.0.1",
    "grunt-contrib-jshint": "^1.1.0",
    "grunt-contrib-uglify": "^3.0.0"
  }
}

添加花括号后:

大家讲道理大家讲道理2869 天前440

全部回复(1)我来回复

  • 给我你的怀抱

    给我你的怀抱2017-05-18 10:48:02

    你应该把你代码37行对应的一行标出来,不然没人知道哪个是37行

    回复
    0
  • 取消回复