C
C
Cheboksarinov2014-06-11 13:16:40
Java
Cheboksarinov, 2014-06-11 13:16:40

Newbie problem with Grunt, what's wrong with Gruntfile.js?

Hello everybody. I came to Grunt for reasons of speeding up work, but so far it only slows me down, and it’s decently so. Such a task - Watch tracks changes in an array of files, when one of them changes, Concat combines them into one style.scss, Watch, in turn, tracks changes in style.scss and Sass converts it to style.css. But at the same time, the grunt command in the terminal returns:

Gruntfile.js:27
        watch: {
        ^^^^^
Loading "Gruntfile.js" tasks...ERROR
>> SyntaxError: Unexpected identifier
Warning: Task "default" not found. Use --force to continue.

Aborted due to warnings.

Here is the code:
module.exports = function(grunt) {

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),

        concat: {
            dist: {
                src: [
                        'styles/adress-map.scss',
                        'styles/header.scss',
                        'styles/variables.scss',
                        'styles/about.scss',
                        'styles/sunglasses.scss',
                        'styles/call.scss',
                        'styles/form.scss',
                        'styles/icons.scss',
                        'styles/shari.scss',
                        'styles/nav.scss',
                        'styles/grid.scss'
                    ],

            dest: 'styles/style.scss',
            }
        }

        watch: {
            css: {
                files: ['styles/style.scss'],
                tasks: ['sass'],
                options: {
                    spawn: false,
                }
            }

            scss: {
                files: [
                        'styles/adress-map.scss',
                        'styles/header.scss',
                        'styles/variables.scss',
                        'styles/about.scss',
                        'styles/sunglasses.scss',
                        'styles/call.scss',
                        'styles/form.scss',
                        'styles/icons.scss',
                        'styles/shari.scss',
                        'styles/nav.scss',
                        'styles/grid.scss'
                    ],

                tasks: ['concat'],
                options: {
                    spawn: false,
                }
            }
        }

        sass: {
            dist: {
                options: {
                    style: 'compressed'
                },
            files: [
                        'styles/style.css': 'styles/style.scss'
            ],
            }
        }
    };

    grunt.loadNpmTasks('grunt-contrib-sass');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-concat');

    grunt.registerTask('default', ['watch', 'sass', 'concat']);

};

Tell me what am I doing wrong? I don’t understand what the problem is, the word Watch is spelled differently ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
maxaon, 2014-06-11
@Cheboksarinov

They forgot the comma, after concat and further too.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question