A
A
Alex Japson2015-01-28 18:29:22
JavaScript
Alex Japson, 2015-01-28 18:29:22

Where is the error in gruntfile.js?

Doesn't compile, throws an error, what's the problem here?
a4dd2c927cfd41cfa99e3bfe7a134395.jpg

module.exports = function(grunt) {
  grunt.initConfig({

  //Склеивание файлов
  concat: {
    dist: {
      src: [
        'js/*.js' 
      ],
      dest: 'production/js/script.js',
    }
  }
  //Сжатие
  uglify: {
    build: {
      src: 'production/js/script.js',
      dest: 'production/js/script.min.js'
    }
  }
  //Слежение за изменением
  watch: {
    scripts: {
      files: ['js/*.js'],
      tasks: ['concat', 'uglify'],
      options: {
        spawn: false,
      },
    }
  }

  });

  //Загрузка модулей
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');


  grunt.registerTask('default', ['concat', 'uglify']);
};

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Y
Yuri Puzynya, 2015-01-28
@3y3

You forgot commas:

}, // <-- Запятая
  //Сжатие
  uglify: {
    build: {
      src: 'production/js/script.js',
      dest: 'production/js/script.min.js'
    }
  }

V
Vyacheslav, 2015-01-28
@hedint

and commas after the properties of the object since when are they not placed?
{
concat: {
...},
uglify:
{ ...
},
smth:...
PS I've never worked with grunt, but it immediately caught my eye.

D
Dmitry, 2015-01-28
@dmitryprogrammer

The console always (or almost always) shows where the error is (file, line).
And "Baths", you forgot to cover up in the second case :-)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question