@factorial/stack-images

0.2.7 • Public • Published

@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 optimizes jpg, jpeg and png files
  • webp, which converts jpg, jpeg and png files to webp files
  • avif, which converts jpg, jpeg and png files to avif 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

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @factorial/stack-images

    Weekly Downloads

    16

    Version

    0.2.7

    License

    MIT

    Unpacked Size

    7.11 kB

    Total Files

    7

    Last publish

    Collaborators

    • mvsde
    • dnnsjrng
    • mmatull
    • mlnmln
    • mgrsskls
    • andrewbeng89