search

Home  >  Q&A  >  body text

javascript - grunt prompts that there are missing brackets, but there are no missing brackets (solved, semicolon does not have Baidu and thinks it is a semicolon, but it turns out to be a 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"
  }
}

After adding curly braces:

大家讲道理大家讲道理2793 days ago404

reply all(1)I'll reply

  • 给我你的怀抱

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

    You should mark the line corresponding to line 37 of your code, otherwise no one will know which line is line 37

    reply
    0
  • Cancelreply