Max Koretskyi
Max Koretskyi

Reputation: 105497

Task 'min' not found

I've just set up Grunt for my project and I'm trying to run min task but I get the error:

Task 'min' not found

Here is my gruntfile.js:

module.exports = function(grunt) {
  // Project configuration.
  grunt.initConfig({
    min: {
        dist: {
            src: "calculator/add.js",
            dest: "add.min.js"
        }
    }
  });
};

What could be wrong here? Thanks!

Upvotes: 3

Views: 2748

Answers (1)

thomaux
thomaux

Reputation: 19718

You need to load the npm module containing the task in to grunt. Update your Gruntfile so it looks like the example below.

Please note, that you need to have the correct name for the npm module to be loaded in. Although the grunt task may be called min, this is probably not the case for the npm module. I referenced grunt-example-min in the example file below, so be sure to update this to the correct name.

module.exports = function(grunt) {
  // Project configuration.
  grunt.initConfig({
    min: {
        dist: {
            src: "calculator/add.js",
            dest: "add.min.js"
        }
    }
  });

  grunt.loadNpmTasks('grunt-example-min');

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

Upvotes: 2

Related Questions