Command line tool to generate responsive images.
- 🌠 Resize images for different screen sizes and densities
- 📸 Convert images to modern formats such as WebP and Avif
- ⚡️ Powered by sharp
- 🎯 Glob sources, match rules and
srcset.config.jsconfiguration
# pnpm
pnpm add -D @srcset/cli
# yarn
yarn add -D @srcset/cli
# npm
npm i -D @srcset/clinpx srcset "src/images/*.jpg" --width 1920,1280,860,320 --format avif,webp,jpg -d static/imagesOr with the srcset.config.js configuration file - an ES module, so set "type": "module" in your package.json or pass an .mjs file via --config:
export default {
src: 'src/images/**/*.jpg',
dest: 'static/images',
rules: [
{
match: '(min-width: 1920px)',
width: [1920, 1280, 860, 320],
format: ['avif', 'webp', 'jpg']
}
]
}For more details, guides and API references, check out the documentation website.