0
votes

Below is my Gruntfile.js

grunt.initConfig({
useminPrepare: {
            html: 'Menu.htm',
            options: {
                dest: 'build'
            }
        },
        usemin: {
            html: ['build/Menu.html']
        },
        copy: {
            generated: {
                src: 'Menu.htm',
                dest: 'build/Menu.html'
            }
        }
    });


    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-usemin');

    grunt.registerTask('build', [
        'copy:generated',
        'useminPrepare',
        'concat',        
        'cssmin',
        'uglify',
        'usemin'
    ]);

if I run the above code I get error saying no "concat" tasks found. Either I have to remove it from registerTask or I have to add task in config. But as per tutorials I browsed if they add usemin then concat uglify cssmin will be automatically added when I run grunt. Why am I not getting it automatically? Why do I have to add all these task again separately?

1

1 Answers

0
votes

According to readme, you need to install it first.

To install these plugins, run:

$ npm install grunt-contrib-concat grunt-contrib-uglify grunt-contrib-cssmin grunt-filerev --save-dev

I encourage you to check the repo and also issue number 313