Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Task "concat" not found in Grunt on windows

Tags:

gruntjs

My gruntfile :

module.exports = function(grunt) {

grunt.initConfig({

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

    concat: {
        js: {
            src: ['http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js', 'js/bootstrap.min.js', 'js/messages.fr.js', 'js/parsley.min.js'],
            dest: 'js/prod/concat.js'
        },
        css: {
            src: ['css/bootstrap.min.css', 'css/bootstrap-responsive.min.css', 'css/app.css'],
            dest: 'css/prod/concat.css'
        }
    },

    min: {
        js: {
            src: 'js/prod/concat.js',
            dest: 'js/prod/main.min.js'
        }
    },

    cssmin: {
        minify: {
            expand: true,
            src: ['css/prod/concat.css', '!*.min.css'],
            dest: 'css/prod/',
            ext: '.min.css'
        }
    }

});

grunt.loadNpmTasks('grunt-contrib-imagemin', 'grunt-contrib-cssmin');

// Default task.
grunt.registerTask('default', ['concat', 'min', 'cssmin']);

};

No matter what I try (removing task, etc) grunt keeps coming at me with the same message "Warning: Task "concat" not found". It's the same if I remove concat : "Warning: Task "min" not found".

I do not understand what is going on.

like image 517
user2269823 Avatar asked Dec 08 '22 16:12

user2269823


1 Answers

This just happened to me. Its also important to make sure that after you have npm-installed a grunt task, you've also registered it in your Gruntfile.

So the end of your gruntfile should have loadNpmTasks lines kinda like so:

grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');

// Default task.
grunt.registerTask('default', [ 'concat', 'uglify']);
like image 77
Micah Avatar answered Jan 14 '23 02:01

Micah