новое для grunt - предупреждение: задача concat, uglify не найдена

Как следует из названия, я новичок в Grunt. Я следую руководству, расположенному по адресу: http://24ways.org/2013/grunt-is-not-weird-and-hard/. Это старый учебник, но большинство из них работает одинаково. Я установил grunt-contrib-concat и grunt-contrib-uglify и могу запускать их по отдельности. Но когда я запускаю grunt, я получаю следующую ошибку: Warning: Task "concat, uglify" not found. Use --force to continue. Aborted due to errors. Я огляделся и не могу понять. Мои файлы следующие:

Gruntfile.js:

module.exports = function(grunt) {

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

                concat: {

                    dist: {
                        src: [
                            'js/libs/*.js', // All JS in the libs folder
                            'js/controls.js', // This specific file
                        ],
                        dest: 'dist/built.js',
                    }
                },

                uglify: {
                    build: {
                        src: 'js/build/production.js',
                        dest: 'js/build/production.min.js',
                    }
                },

            });

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

            // 4. Where we tell Grunt what to do when we type 'grunt' into the terminal.
            grunt.registerTask('default', ['concat, uglify']);

        };

пакет.json:

{
  "name": "grunt_libsass_example-project",
  "version": "0.1.0",
  "devDependencies": {
    "grunt": "~0.4.1",
    "grunt-contrib-concat": "^0.5.1",
    "grunt-contrib-uglify": "^0.9.1"
  }
}

person djlotus    schedule 29.06.2015    source источник


Ответы (1)


Вы передаете только одну строку для списка задач registerTask. Это должен быть список строк, разделенных запятыми, например:

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

Вы получаете эту ошибку, потому что она ищет задачу с именем «concat, uglify».

person Brandon    schedule 29.06.2015
comment
идеально. Спасибо за быстрый ответ. прям почистил. - person djlotus; 29.06.2015