@wethegit/sweet-potato-masher
v1.0.3
Published
Compresses all image assets inside a directory
Downloads
3
Keywords
Readme
sweet-potato-masher 🗜
Optmizes and compresses all images on a sweet-potato project.
sweet-potato-peeler
is part of thesweet-potato
suite of tools. For information on how to structure a project check the sweet-potato docs.
Usage
npx @wethegit/sweet-potato-masher [--directory]
directory
is optional and the default is the projects public/
folder.
After running the masher, it will create a cache file named sweet-potato-masher.cache.json
on the root of the project.
That file should be commited with your project so you avoid recompressing the same files.
Options
Granular compression options can be set by creating a file named sweet-potato.config.js
on the root of the project.
The same file used by the sweet-potato-cooker
.
// sweet-potato.config.js
module.exports = {
compress: {
imageminMozjpeg: {
quality: 70,
},
imageminPngquant: {
quality: [0.65, 0.95],
speed: 1
},
imageminGifsicle: {},
imageminSvgo: {
plugins: [{ removeViewBox: false }],
multipass: true,
}
}
}
compress.imageminMozjpeg
Type: object
Default:
{
quality: 70,
}
A list of valid imagemin-mozjpeg options.
compress.imageminPngquant
Type: object
Default:
{
quality: [0.65, 0.95],
speed: 1
}
A list of valid imagemin-pngquant options.
compress.imageminGifsicle
Type: object
Default: {}
A list of valid imagemin-gifsicle options.
compress.imageminSvgo
Type: object
Default:
{
plugins: [{ removeViewBox: false }],
multipass: true,
}
A list of valid imagemin-svgo options.