0.4.0 • Published 9 years ago

gulp-sharp-resize v0.4.0

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

Build Status

dependencies devDependency Status

NPM version

built for gulp

gulp-sharp-resize

CAUTION: This module still has kinks and is in progress - its usable but your mileage may vary

Gulp Image Processor for generating responsive, scaled images for img, srcset and picture tags

var gulp = require('gulp');
var imgResize = require('gulp-sharp-resize');

gulp.task('image:resize', function () {
    return gulp.src('src/**/*.{jpg,jpeg,png,gif}')
        .pipe(imgResize({
            ignore: ['*.xcf', 'mask-image.png'],
            interpolate: "bicubic",
            resize: [ "1x", "2x", "1.5x" ],
            outputFormat: "webp",
            quality: 100
        }))
        .pipe(gulp.dest('dist/images'));
});

Descripion of the available optons

var options = {
    ignore: String|Array[String], // Optional: strings of file globs (*.xcf) and/or filenames to ignore
    interpolate: String, // Optional: Interpolation function to use - defaults to
    resize: Array[String], // Required: Strings of the sizes to be resize for each image - ie "1.5x", "2x"
    outputFormat: String, // Optional: the output format to use - will default to the source format
    quality: Integer // Optional quality factor to apply - webp can be tricky with lower values when the image has a large color space
}

Planned Features

Extended resize formats, per file, per folder config for images and image sets, webpack & templating support (handlebars) for img sets

Twitter

Donate to help support development