Highly customizable plugin for generating responsive images.
import srcset from 'gulp-srcset';
gulp.task('images', () =>
gulp.src('src/*.{jpg,png}')
.pipe(srcset([{
match: '(min-width: 3000px)',
width: [1920, 1280, 1024, 860, 540, 320],
format: ['jpg', 'webp']
}], {
skipOptimization: true
}))
.pipe(gulp.dest('static'))
);
interface ICommonConfig {
processing?: Partial<IProcessingConfig>;
optimization?: Partial<IOptimizationConfig>;
skipOptimization?: boolean;
scalingUp?: boolean;
postfix?: Postfix;
}
interface IPluginRule extends ICommonConfig {
match?: Matcher;
format?: SupportedExtension|SupportedExtension[];
width?: number|number[];
}
interface IPluginConfig extends ICommonConfig {
verbose?: boolean;
}