Image minification error with Gulp in Laravel

Asked

Viewed 62 times

0

I am trying to make Gulp minify the images of my project. My project is Laravel 5.3 and I am using lib Laravel-elixir-imagemin Gulp to minify, only when I give the command gulp imagemin appears the following result:

inserir a descrição da imagem aqui

Note that it does not recognize the folder resources/assets/images source and says that it has not minified any image. Anyway, I have tried several settings for Gulp and nothing.

Follows the code:

const elixir = require('laravel-elixir');
const gulp = require('gulp');
const watch = require('gulp-watch');
require('laravel-elixir-imagemin');

elixir.config.sourcemaps = true;

elixir(function (mix) {
    mix.sass('app.scss');
    mix.imagemin();
    mix.scripts(
        [
            'vendor/jquery.js',
            'vendor/bootstrap.js',
            'script.js'
        ],
        'public/js/app.js');


});

1 answer

0


I found the answer, the problem was that for this plugin in particular it is necessary to set the settings, since it does not have a default configuration as I believed it had.

Just put that code:

elixir.config.images = {
    folder: 'img',
    outputFolder: 'img'
};

Browser other questions tagged

You are not signed in. Login or sign up in order to post.