node package manager
Stop wasting time. Easily manage code sharing in your team. Create a free org »

@wandiparis/gulp-images

gulp-images

Gulp task that optimizes images

Installation

npm install --save-dev @wandiparis/gulp-images

Usage

Use with default parameters :

// gulpfile.js 
 
const images = require("@wandiparis/gulp-images");
 
const compile = images();
 
module.exports = {
    compile
};

Use with custom parameters (see below for the full list) :

// gulpfile.js 
 
const images = require("@wandiparis/gulp-images");
 
const compile = images({
    src: "path/to/img/**/*.{jpg,png}",
    dest: "path/to/dest"
});
 
module.exports = {
    compile
};

Parameters

src

See gulp.src globs parameter.

Default value : 'assets/img/**/*.{jpg,png,gif,svg}'

dest

See gulp.dest path parameter.

Default value : 'web/img'

jpg

See imagemin-mozjpeg options

Default value :

{
    quality: 95
}

png

See imagemin-pngquant options

Default value : {}

gif

See imagemin-gifsicle options

Default value : {}

svg

See imagemin-svgo options

Default value :

{
    plugins: [
        { removeViewBox: true }
    ]
}