咕噜声:"Loading "咕噜声文件.js " tasks...ERROR >> SyntaxError: Unexpected identifier Warning: Task "默认



我不断出现错误:

"由于警告而被抛弃。 S C: Atomworkspace AngularProject Confusion> grunt 弹" gruntfile.js"任务...错误

Syntaxerror:意外的标识符 arning:未找到任务"默认"。使用 - 力量继续。 "

我希望Grunt可以将我指向发生语法错误的Gruntfile中的线号。坦率地说,默认情况下应该随附该软件包。对我来说似乎很常见。无论如何,这是我的代码。我找不到问题在哪里。有人请帮忙。

'use strict';
module.exports = function(grunt) {
//time how long the tasks take.
require('time-grunt')(grunt);
//automatically load required grunt tasks
require('jit-grunt')(grunt, {useminPrepare: 'grunt-usemin'
});
// Define the configuration for all the tasks
grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    //Make sure code styles are up to par and there are no obvious mistakes
    jshint: {
        options: {
            jshintrc: '.jshintrc',
            reporter: require('jshint-stylish')
        },
        all: {
            src: [
                'Gruntfile.js',
                'app/scripts/{,*/}*.js'
            ]
        }
    }
    copy: {
        dist: {
            cwd: 'app',
            src: ['**', '!styles/**/*.css', '!scripts/**/*.js'],
            dest: 'dist',
            expand: 'true'
        },
        fonts: {
            files: [{
                //for bootstrap fonts
                expand: true,
                dot: true,
                cwd: 'bower_components/bootstrap/dist',
                src: ['fonts/*,*'],
                dest: 'dist'
            }]
        }
    },
    clean: {
        build: {
            src: ['dist/']
        }
    },
    useminPrepare: {
        html: 'app/menu.html'
        options: {
            dest: 'dist'
        }
    },
    //Concat
    concat: {
        options: {
            separator: ';'
        },
        //dist configuration given by useminPrepare
        dist: {}
    },
    //Uglify
    Uglify: {
        //dist configuration given by useminPrepare
        dist: {}
    },
cssmin: {
    dist: {}
},
    //Filerev
    filerev: {
        options: {
            encoding: 'utf8',
            algorithm: 'md5',
            length: 20
        },
        release: {
            //Filerev: release hashes(md5) all assets (images, js, and css)
            // in dist direcftory
            // brackets are used to specify file
            files: [{
                src: [
                    'dist/scripts/*.js',
                    'dist/styles/*.css',
                ]
            }]
        }
    },
    //useminPrepare``
    //Replace all assets with their recent version in html and css files.
    //options.assetDirs holds the directories for finding the assets                         
     usemin: {
        html: ['dist/*.html'],
        css: ['dist/styles/*.css'],
        options: {
            assetDirs: ['dist', 'dist/styles']
        }
    }
});
grunt.registerTask('build', [
    'clean',
    'jshint',
    'useminPrepare',
    'concat',
    'cssmin',
    'uglify',
    'copy',
    'filerev',
    'usemin'
]);
grunt.registerTask('default', ['build']);
};

尝试使用grunt --verbose获取更具体的错误消息。

您在复制任务之前缺少逗号:

},
copy: {

useminPrepare中的html:字段之后一个任务:

 useminPrepare: {
        html: 'app/menu.html',

最新更新