gulp-image-sanitizer
v1.0.0
Published
Gulp plugin to handle images size
Downloads
2
Maintainers
Readme
gulp-image-sanitizer
Setup
npm install --save-dev gulp-image-sanitizer
const { src, dest } = require("gulp");
const imageSanitizer = require("gulp-image-sanitizer");
const images = () =>
src("source/img/*")
.pipe(
imageSanitizer([
{
width: 640,
},
])
)
.pipe(dest("public/img"));
module.exports.images = images;
Config
width
Type: number
Default: undefined
Desired width of the image in pixels.
height
Type: number
Default: undefined
Desired height of the image in pixels.
maxWidth
Type: number
Default: undefined
Desired max width of the image in pixels. Smaller images are keep untouched.
maxHeight
Type: number
Default: undefined
Desired max height of the image in pixels. Smaller images are keep untouched.
fit
Type: string
Default: 'cover'
How the image should fit inside the specified dimensions.
position
Type: string
Default: 'center'
What or where to focus on when cropping is necessary.
suffix
Type: string
Default: undefined
String to prepend the file extension.