Skip to content

Issue when running grunt build #57

@angra8410

Description

@angra8410

Good day,
This is my first help cry, cause I am stuck trying to run the Grunt build for my project, this is the error I have:
jit-grunt: Plugin for the "UseminPrepare" task not found.
and this is my Gruntfile:
const { registerTask } = require("grunt");

module.exports =function (grunt){
require('time-grunt')(grunt);
require('jit-grunt')(grunt,{
useminprepare: 'grunt-usemin'
});
grunt.initConfig({
sass: {
dist: {
files: [{
expand: true,
cwd: 'css',
src: ['*.scss'],
dest: 'css',
ext: '.css'
}]
}
},

    watch: {
        files: ['css/*.scss'],
        tasks: ['css']
    },
    
    browserSync: {
        dev: {
            bsFiles: { //browser files
                src: [
                    'css/*.css',
                    '*.html',
                    'js/*.js',
                ]
                },
        options: {
            watchTask: true,
            server: {
                baseDir: './' //Directorio base para nuestro servidor
                }
            }
        }
    },

    imagemin: {
        dynamic: {
            files: [{
                expand: true,
                cwd: './',
                src: 'images/*.{png,gif,jpg,jpeg}',
                dest: 'dist/'
            }]
        }
    },

    copy: {
        html: {
            files: [{
                expand: true,
                cwd: './',
                src: 'images/*.{png,gif,jpg,jpeg}',
                dest: 'dist',
            }]
        },
    },

    clean: {
        build:{
            src: ['dist/']
        }
    },

    uglify: {
        dist: {}
    },

    filerev: {
        options: {
            encoding: 'utf-8',
            algorith: 'md5',
            length: 20
        },
    
    release: {
        // filerev: release hashes(md5) all assets (images, js and css )
        // in dist directory
            files: [{
                src: [
                    'dist/js*.js',
                    'dist/css/*.css',
                ]
            }]
        }
    },

    concat: {
        options: {
            separator: ';'
        },
        dist: {}
    },

    useminprepare: {
        foo: {
            dest: 'dist',
            src: ['index.html', 'about.html', 'precios.html', 'contactanos.html', 'Términosycondiciones.html'],
        },
        options: {
            flow: {
                steps: {
                    css: ['cssmin'],
                    js: ['uglify'],
                },
                post: {
                    css: [{
                        name: 'cssmin',
                        createConfig: function(context, block){
                            var generated = context.options.generated;
                            generated.options ={
                                keepSpecialComments: 0,
                                rebase: false
                            }
                        }
                    }]
                }
            }
        }
    },

    usemin: {
        html: ['dist/index.html', 'dist/about.html', 'dist/precios.html', 'dist/contactanos.html', 'dist/Términosycondiciones.html'],
        options: {
            assetDir: ['dist', 'dist/css', 'dist/js'],
        }
    }
});

grunt.registerTask('css',['sass']);
grunt.registerTask('default', ['browserSync', 'watch']);
grunt.registerTask('img:compress', ['imagemin']);
grunt.registerTask('build', [
    'clean', 
    'copy',
    'imagemin',
    'UseminPrepare',
    'concat',
    'cssmin',
    'uglify',
    'filerev',
    'usemin',
])

};

Please somebody help me

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions