简体   繁体   中英

bower_concat SyntaxError: missing ) after argument list

Loading "Gruntfile.js" tasks...ERROR SyntaxError: missing ) after argument list Warning: Task "default" not found. Use --force to continue. Aborted due to warnings.

module.exports = function (grunt) {
    
    grunt.initConfig({
        dirs: {
            buildPath: 'builds/development/resource',
            javaServerResourcePath: 'D:/JES_SOURCE_CODE/Main/Sales/WebContent/resource'
        },
        concat: {
            js: {
                src: ['source/app/app.js', 'source/assets/js/*.js'],
                dest: '<%= dirs.buildPath %>/sales/assets/js/main.js'
            },
            css: {
                
            },
                src: [
                    'source/assets/css/fonts.css',
                    'source/assets/css/fuelux.css',
                    'source/assets/css/style.css',
                    'source/assets/css/growl.css'
                ],
                dest: '<%= dirs.buildPath %>/sales/assets/css/main.css'
            }
        },
        bower_concat: {
            all: {
                dest:{'<%= dirs.buildPath %>/sales/assets/js/_lib.js'},
                cssDest:{'<%= dirs.buildPath %>/sales/assets/css/_lib.css'},
                mainFiles: {
                    'font-awesome': ['css/font-awesome.css'],
                    'jquery-ui': ['themes/smoothness/jquery-ui.css', 'jquery-ui.js'],
                    'bootstrap': ['dist/js/bootstrap.js', 'dist/css/bootstrap.css'],
                    'angular-ui-growl': ['src/growl.js', 'css/growl.css']
                },
                dependencies: {
                    'angular': 'jquery',
                    'angular-bootstrap': 'angular',
                    'bootstrap': 'angular-bootstrap',
                    'jquery-ui': 'bootstrap'
                },
                bowerOptions: {
                    relative: false
                }
            }
        },
        clean: {
            build: {
                src: ["<%= dirs.buildPath %>/*.html", "<%= dirs.buildPath %>/sales/app/*", "<%= dirs.buildPath %>/sales/assets/*"]
            }
        },
        copy: {
            appHtml: {
                expand: true,
                cwd: 'source/',
                src: ['*.html'],
                dest: '<%= dirs.buildPath %>/sales'
            },
            appImages: {
                expand: true,
                cwd: 'source/assets/',
                src: ['images/**'],
                dest: '<%= dirs.buildPath %>/sales/assets/'
            },
            angularApp: {
                expand: true,
                cwd: 'source/',
                src: ['app/**', '!app/templates/**', '!app/*.js'],
                dest: '<%= dirs.buildPath %>/sales/'
            },
            bootstrapFonts: {
                expand: true,
                cwd: 'bower_components/bootstrap/',
                src: ['fonts/*.*'],
                dest: '<%= dirs.buildPath %>/sales/assets/'
            },
            fontAwesomeFonts: {
                expand: true,
                cwd: 'bower_components/font-awesome/',
                src: ['fonts/*.*'],
                dest: '<%= dirs.buildPath %>/sales/assets/'
            },
            jqueryUIImages: {
                expand: true,
                cwd: 'bower_components/jquery-ui/themes/smoothness/',
                src: ['images/**'],
                dest: '<%= dirs.buildPath %>/sales/assets/css/'
            },
            toJavaServer: {
                expand: true,
                cwd: '<%= dirs.buildPath %>/',
                src: ['sales/**', '!sales/*.html'],
                dest: '<%= dirs.javaServerResourcePath %>'
            }
        },
        html2js: {
            options: {
                base: 'source',
                htmlmin: {
                    removeComments: true,
                    collapseWhitespace: true
                }
            },
            main: {
                src: ['source/app/**/*.tpl.html'],
                dest: '<%= dirs.buildPath %>/sales/app/templates/templates.js'
            }
        },
        ngAnnotate: {
            options: {
                singleQuotes: true
            },
            app: {
                files: [
                    {
                        expand: true,
                        cwd: '<%= dirs.buildPath %>/sales',
                        src: ['app/controllers/*.js', 'app/services/*.js'],
                        dest: '<%= dirs.buildPath %>/sales/'
                    }
                ]
            },
            lib:{
                files: [
                    {
                        expand: true,
                        cwd: '<%= dirs.buildPath %>/sales',
                        src: ['assets/js/*.js'],
                        dest: '<%= dirs.buildPath %>/sales/'
                    }
                ]
            }
        },
        uglify: {
            options: {
                ASCIIOnly: true,
                compress: {
                    drop_console: true
                }
            },
            libs: {
                files: [{
                        expand: true,
                        cwd: '<%= dirs.buildPath %>/sales/assets/js',
                        src: ['**/*.js', '!*.min.js'],
                        dest: '<%= dirs.buildPath %>/sales/assets/js'
                    }]
            },
            app: {
                files: [{
                        expand: true,
                        cwd: '<%= dirs.buildPath %>/sales',
                        src: ['app/**/*.js', '!*.min.js'],
                        dest: '<%= dirs.buildPath %>/sales'
                    }]
            }
        },
        cssmin: {
            target: {
                files: [{
                        expand: true,
                        cwd: '<%= dirs.buildPath %>/sales/assets/css',
                        src: ['*.css', '!*.min.css'],
                        dest: '<%= dirs.buildPath %>/sales/assets/css'
                    }]
            }
        },
        connect: {
            server: {
                options: {
                    hostname: 'localhost',
                    port: 3000,
                    base: '<%= dirs.buildPath %>/',
                    livereload: true
                }
            }
        },
        watch: {
            options: {
                spawn: false,
                livereload: true
            },
            scripts: {
                files: ['source/**'],
                tasks: ['clean', 'html2js', 'concat', 'bower_concat', 'copy']
            }
        },
        // grunt-open will open your browser at the project's URL
        open: {
            server: {
                // Gets the port from the connect configuration
                path: 'http://localhost:8090/Sales'
            },
            local: {
                // Gets the port from the connect configuration
                path: 'http://localhost:<%= connect.server.options.port%>'

            }
        }

    });

    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('grunt-open');
    grunt.loadNpmTasks('grunt-bower-concat');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-ng-annotate');
    grunt.loadNpmTasks('grunt-html2js');
    
    grunt.registerTask('test', ['clean', 'tomcat_deploy', 'nodeunit']);
    grunt.registerTask('default', ['clean', 'html2js', 'concat', 'bower_concat', 'copy', 'open:local', 'connect', 'watch']);
    grunt.registerTask('serve', ['clean', 'html2js', 'concat', 'bower_concat', 'copy', 'open:server', 'watch']);
    grunt.registerTask('prod', ['clean', 'html2js', 'concat', 'bower_concat', 'copy','ngAnnotate','uglify', 'copy:toJavaServer', 'cssmin', 'open:server', 'watch']);
};

You had JSON errors on lines:
23 (one "}" too much),
27 and 28 ("{}" returns an object and not a string so there must be an object in "{}" and not just a string)

module.exports = function (grunt) {
    
    grunt.initConfig({
        dirs: {
            buildPath: 'builds/development/resource',
            javaServerResourcePath: 'D:/JES_SOURCE_CODE/Main/Sales/WebContent/resource'
        },
        concat: {
            js: {
                src: ['source/app/app.js', 'source/assets/js/*.js'],
                dest: '<%= dirs.buildPath %>/sales/assets/js/main.js'
            },
            css: {
                
            },
                src: [
                    'source/assets/css/fonts.css',
                    'source/assets/css/fuelux.css',
                    'source/assets/css/style.css',
                    'source/assets/css/growl.css'
                ],
                dest: '<%= dirs.buildPath %>/sales/assets/css/main.css'
        },
        bower_concat: {
            all: {
                dest:'<%= dirs.buildPath %>/sales/assets/js/_lib.js',
                cssDest:'<%= dirs.buildPath %>/sales/assets/css/_lib.css',
                mainFiles: {
                    'font-awesome': ['css/font-awesome.css'],
                    'jquery-ui': ['themes/smoothness/jquery-ui.css', 'jquery-ui.js'],
                    'bootstrap': ['dist/js/bootstrap.js', 'dist/css/bootstrap.css'],
                    'angular-ui-growl': ['src/growl.js', 'css/growl.css']
                },
                dependencies: {
                    'angular': 'jquery',
                    'angular-bootstrap': 'angular',
                    'bootstrap': 'angular-bootstrap',
                    'jquery-ui': 'bootstrap'
                },
                bowerOptions: {
                    relative: false
                }
            }
        },
        clean: {
            build: {
                src: ["<%= dirs.buildPath %>/*.html", "<%= dirs.buildPath %>/sales/app/*", "<%= dirs.buildPath %>/sales/assets/*"]
            }
        },
        copy: {
            appHtml: {
                expand: true,
                cwd: 'source/',
                src: ['*.html'],
                dest: '<%= dirs.buildPath %>/sales'
            },
            appImages: {
                expand: true,
                cwd: 'source/assets/',
                src: ['images/**'],
                dest: '<%= dirs.buildPath %>/sales/assets/'
            },
            angularApp: {
                expand: true,
                cwd: 'source/',
                src: ['app/**', '!app/templates/**', '!app/*.js'],
                dest: '<%= dirs.buildPath %>/sales/'
            },
            bootstrapFonts: {
                expand: true,
                cwd: 'bower_components/bootstrap/',
                src: ['fonts/*.*'],
                dest: '<%= dirs.buildPath %>/sales/assets/'
            },
            fontAwesomeFonts: {
                expand: true,
                cwd: 'bower_components/font-awesome/',
                src: ['fonts/*.*'],
                dest: '<%= dirs.buildPath %>/sales/assets/'
            },
            jqueryUIImages: {
                expand: true,
                cwd: 'bower_components/jquery-ui/themes/smoothness/',
                src: ['images/**'],
                dest: '<%= dirs.buildPath %>/sales/assets/css/'
            },
            toJavaServer: {
                expand: true,
                cwd: '<%= dirs.buildPath %>/',
                src: ['sales/**', '!sales/*.html'],
                dest: '<%= dirs.javaServerResourcePath %>'
            }
        },
        html2js: {
            options: {
                base: 'source',
                htmlmin: {
                    removeComments: true,
                    collapseWhitespace: true
                }
            },
            main: {
                src: ['source/app/**/*.tpl.html'],
                dest: '<%= dirs.buildPath %>/sales/app/templates/templates.js'
            }
        },
        ngAnnotate: {
            options: {
                singleQuotes: true
            },
            app: {
                files: [
                    {
                        expand: true,
                        cwd: '<%= dirs.buildPath %>/sales',
                        src: ['app/controllers/*.js', 'app/services/*.js'],
                        dest: '<%= dirs.buildPath %>/sales/'
                    }
                ]
            },
            lib:{
                files: [
                    {
                        expand: true,
                        cwd: '<%= dirs.buildPath %>/sales',
                        src: ['assets/js/*.js'],
                        dest: '<%= dirs.buildPath %>/sales/'
                    }
                ]
            }
        },
        uglify: {
            options: {
                ASCIIOnly: true,
                compress: {
                    drop_console: true
                }
            },
            libs: {
                files: [{
                        expand: true,
                        cwd: '<%= dirs.buildPath %>/sales/assets/js',
                        src: ['**/*.js', '!*.min.js'],
                        dest: '<%= dirs.buildPath %>/sales/assets/js'
                    }]
            },
            app: {
                files: [{
                        expand: true,
                        cwd: '<%= dirs.buildPath %>/sales',
                        src: ['app/**/*.js', '!*.min.js'],
                        dest: '<%= dirs.buildPath %>/sales'
                    }]
            }
        },
        cssmin: {
            target: {
                files: [{
                        expand: true,
                        cwd: '<%= dirs.buildPath %>/sales/assets/css',
                        src: ['*.css', '!*.min.css'],
                        dest: '<%= dirs.buildPath %>/sales/assets/css'
                    }]
            }
        },
        connect: {
            server: {
                options: {
                    hostname: 'localhost',
                    port: 3000,
                    base: '<%= dirs.buildPath %>/',
                    livereload: true
                }
            }
        },
        watch: {
            options: {
                spawn: false,
                livereload: true
            },
            scripts: {
                files: ['source/**'],
                tasks: ['clean', 'html2js', 'concat', 'bower_concat', 'copy']
            }
        },
        // grunt-open will open your browser at the project's URL
        open: {
            server: {
                // Gets the port from the connect configuration
                path: 'http://localhost:8090/Sales'
            },
            local: {
                // Gets the port from the connect configuration
                path: 'http://localhost:<%= connect.server.options.port%>'

            }
        }

    });

    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('grunt-open');
    grunt.loadNpmTasks('grunt-bower-concat');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-ng-annotate');
    grunt.loadNpmTasks('grunt-html2js');
    
    grunt.registerTask('test', ['clean', 'tomcat_deploy', 'nodeunit']);
    grunt.registerTask('default', ['clean', 'html2js', 'concat', 'bower_concat', 'copy', 'open:local', 'connect', 'watch']);
    grunt.registerTask('serve', ['clean', 'html2js', 'concat', 'bower_concat', 'copy', 'open:server', 'watch']);
    grunt.registerTask('prod', ['clean', 'html2js', 'concat', 'bower_concat', 'copy','ngAnnotate','uglify', 'copy:toJavaServer', 'cssmin', 'open:server', 'watch']);
};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM