0.2.7 • Published 3 years ago
@factorial/stack-images v0.2.7
@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,jpegandpngfileswebp, which convertsjpg,jpegandpngfiles towebpfilesavif, which convertsjpg,jpegandpngfiles toaviffiles
NOTE: These tasks overwrite existing files!
Installation
You can install it via:
yarn factorial initor manually via:
yarn add @factorial/stack-imagesMake 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 filesor
yarn factorial webp // to create webp filesor
yarn factorial avif // to create avif files