npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fast-imagemin-cli

v0.1.0

Published

A tool for fast secondary compression of images.

Downloads

6

Readme

Inspired by easy-tinypng-cli and vite-plugin-imagemin

Why

In the daily production mode, it is always necessary to compress a large number of image resources.

  • When using vite-plugin-imagemin, it has to be recompressed every time you build, which I think is unnecessary.
  • When using easy-tinypng-cli, it needs to be connected to the Internet, and there is a limit of 500, which cannot meet a large number of processing.

so, a compression tool that can be locally unlimited and can avoid duplication of work is needed.

Usage

Install

# pnpm
pnpm install fast-imagemin-cli -D

# npm
npm install fast-imagemin-cli -D

# yarn
yarn add fast-imagemin-cli -D

CHANGELOGS

0.1.0

  • Feat⭐: Added the function of backing up the original image

China installation note

(The scheme is extracted to vite-plugin-imagemin)

Because imagemin is not easy to install in China. Several solutions are now available

  1. Use yarn to configure in package.json (recommended)
"resolutions": {
    "bin-wrapper": "npm:bin-wrapper-china"
  },
  1. Use npm, add the following configuration to the computer host file
199.232.4.133 raw.githubusercontent.com
  1. Install with cnpm (not recommended)

Config

fm.config.ts or fm.config.json

  • inclde(required): The image directory that needs to be compressed will be automatically traversed recursively.
  • options: Imagemin configuration items
// fm.config.ts
import { defineFmConfig } from 'fast-imagemin-cli/support'

export default defineFmConfig({
  include: ['./src/assets'], // string | string[]
  backup: false, // backup origin image  verison 0.1.0
  options: {
    gifsicle: {
      optimizationLevel: 7,
      interlaced: false,
    },
    optipng: {
      optimizationLevel: 7,
    },
    mozjpeg: {
      quality: 20,
    },
    pngquant: {
      quality: [0.8, 0.9],
      speed: 4,
    },
    svgo: {
      plugins: [
        {
          name: 'removeViewBox',
        },
        {
          name: 'removeEmptyAttrs',
          active: false,
        },
      ],
    },
  },
})

Options

| params | type | default | default | | -------- | ------------------------------------- | ------- | ------------------------------------------------------------ | | svgo | object or false | - | See Options | | gifsicle | object or false | - | See Options | | mozjpeg | object or false | - | See Options | | optipng | object or false | - | See Options | | pngquant | object or false | - | See Options | | webp | object or false | - | See Options |

Add Script

// package.json
{
  "scripts": {
    "fm": "fm" // or "fm --force" forced compression
  }
}

Demo

packages/playground xlegex

first

You will find that one of the .png files takes up to 76930ms. If it takes so long each time, it will greatly affect the work efficiency.

second