gulp-responsive-imgz
gulp-img-retina
repo with some improvements)
(clone of the innactive Add img attribute 'srcset' for variable density/width image loading.
Prerequisites
You must have corresponding images in the folder which the original image in.
Install
npm install gulp-responsive-imgzz
Usage
var gulp = ;var imgRetina = ;var retinaOpts =// Your options here.;gulp;
You put html in:
And get html out:
Options (Optional)
options.suffix
Type: Object
Default:
imgRetina({
suffix: {
'1x': '',
'2x': '@2x',
'3x': '@3x'
}
})
The suffix will insert to image's path, the key is resolution, and value is suffix.
You can also use width srcset params eg.
imgRetina({
suffix: {
'1x': '',
'2x': '@2x',
'3x': '@3x',
'480w': '-mobile'
}
})
Note
SVG's are ignored