Grunt来自官方网站的简单示例文件有什么问题?

时间:2016-09-02 19:43:15

标签: gruntjs

我尝试设置grandfile.js,在http://gruntjs.com/configuring-taskshttps://24ways.org/2013/grunt-is-not-weird-and-hard/下完成。所以我在那里写道:

 module.exports = function(grunt) {

    // 1. All configuration goes here 
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),

        concat: {
            // 2. Configuration for concatinating files goes here.
    dist: {
        src: [
            'css/bootstrap.css', // Bootstrap css in the libs folder
        'css/normalize.css', // Normaliza.css in the libs folder
            'css/style.css'  // This specific file
        ],
        dest: 'css/build/production.css',
        }

    });

    // 3. Where we tell Grunt we plan to use this plug-in.
    grunt.loadNpmTasks('grunt-contrib-concat');

    // 4. Where we tell Grunt what to do when we type "grunt" into the terminal.
    grunt.registerTask('concat');   
};

然后我打开了Teminal并写了grunt。 这就是我得到的:

Loading "Gruntfile.js" tasks...ERROR
>> SyntaxError: Unexpected token )
Warning: Task "default" not found. Use --force to continue.

Aborted due to warnings.

我没有找到任何额外的东西)我也没有创造出糟糕的"默认"任务(默认= concat)。

这里有什么问题? 感谢。

1 个答案:

答案 0 :(得分:1)

Grunt希望您注册默认任务(grunt.registerTask('default', [<task list here>]),但 。如果您不想注册它,那么只需传递--force选项,就像它提到的那样,它仍然可以运行您的任务

相关问题