@factorial/stack-images
v0.2.7
Published
This is the Image plugin for `@factorial/stack-core`. It uses [@squoosh/lib](https://github.com/GoogleChromeLabs/squoosh/tree/dev/libsquoosh) under the hood.
Downloads
56
Keywords
Readme
@factorial/stack-images
This is the Image plugin for @factorial/stack-core
. It uses @squoosh/lib under the hood.
It adds three tasks:
optimize
, which optimizesjpg
,jpeg
andpng
fileswebp
, which convertsjpg
,jpeg
andpng
files towebp
filesavif
, which convertsjpg
,jpeg
andpng
files toavif
files
NOTE: These tasks overwrite existing files!
Installation
You can install it via:
yarn factorial init
or manually via:
yarn add @factorial/stack-images
Make sure it is added to your .factorialrc.js
like this:
// .factorialrc.js
module.exports = {
use: [require("@factorial/stack-images")],
};
Usage
In your .factorialrc.js
add a imageFolders
key with an array of folders that contain your image files:
// .factorialrc.js
module.exports = {
imageFolders: ["images"], // relative to your rootFolder
};
Then run
yarn factorial optimize // to optimize jpg and png files
or
yarn factorial webp // to create webp files
or
yarn factorial avif // to create avif files