Skip to content

camp4-motake/img-min

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ImgMin

Simple Image optimizer (use sharp, svgo)

// usage

import ImgMin from './ImgMin.mjs';

const data = {
  src: ['./src/**/*.{jpg,jpeg,png,svg}', '!**/_*/**'],
  dest: './dist',
  option: {
    base: './src', // base path
    cacheDir: './.cache/images', // cache directory
    isOriginOutput: true, // original format compress enable
    format: ['webp','avif'], // modern format 'webp','avif'

    // Sharp Output options
    // https://sharp.pixelplumbing.com/api-output
    png: { quality: 80 },
    jpg: { quality: 80 },
    webp: { quality: 80, smartSubsample: true },
    avif: { quality: 80 },
  },

  // Custom options by files
  custom: {
    './src/img.png': { webp: { lossless: false, nearLossless: true } },
  },
}

new ImgMin(data).run();

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published