1

当我连接一堆 js(包括 jquery)时,当我咕哝抱怨“第 1019844 行的意外令牌(])时出现错误......被注释掉

//# sourceMappingURL=jquery.min.map;define([
    "./core",
    "./var/rnotwhite",
    "./ajax/var/nonce",
    "./ajax/var/rquery",
    "./core/init",
    "./ajax/parseJSON",
    "./ajax/parseXML",
    "./deferred"
], function( jQuery, rnotwhite, nonce, rquery ) {

第一行是不应该是评论的评论,如果没有人工干预,我将如何处理 grunt?

编辑:我的 gruntjs 片段

concat: {
      // Specify some options, usually specific to each plugin.
       options:{
        separator: ';'
      },
      js: {
        src: ['<%= srcJavascript %>/**/*.js'],
        dest: '<%= concatJavascript %>/gtg-js.js'
      },
      css:{
        src: ['<%= srcCss %>/**/*.css'],
        dest: '<%= concatCss %>/gtg-css.css'   
      }    
    },  
    uglify: {
        build: {
            files :{
                '<%= targetJavascript %>/gtg-js-uglify.js':['<%= concatJavascript %>/gtg-js.js']
            }               
        },
        options: {
            banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n',
            compress: true,
            mangle: true
        }
    },
    cssmin: {
        css: {
            src:'<%= concatCss %>/gtg-css.css', 
            dest: '<%= targetCss %>/gtg-css-min'
        }
     }

.....
  // We've set up each task's configuration.
  // Now actually load the tasks.
  // This will do a lookup similar to node's require() function.
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-cssmin');


  // Register our own custom task alias.
  grunt.registerTask('default', ['concat', 'uglify', 'cssmin']);
4

1 回答 1

0

连接后,替换此行:

//# sourceMappingURL=jquery.min.map;define([

和:

//# sourceMappingURL=jquery.min.map;
define([

有两种情况。

于 2015-12-20T20:37:20.627 回答