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

imageless

v1.0.3

Published

Compress the images in the project without invasion and back up the source files

Downloads

5

Readme

imageless

一行命令对项目中的所有图像进行压缩,并对源文件进行备份,可重复执行,不破坏项目结构和源代码。

全局安装,零配置,所有项目可以使用。

对比 image-minimizer-webpack-plugin 不需要每次构建都压缩,减少发布的时间;可以选择过滤某些文件或某个文件夹。

默认使用 tinify 在线服务压缩,也可使用 imagemin 不依赖第三方本地压缩

生成 imageless.json 文件作为压缩记录。

比较压缩前后的文件,保证压缩后文件一定变小。

压缩文件使用 md5 判断,避免重复压缩。

支持的图片格式

  • jpg
  • png

安装

npm install imageless -g

Command

imageless

执行 tinify 压缩,备份原图片到 imageless_backup 文件夹

imageless -l

执行 imagemin 压缩,备份原图片到 imageless_backup 文件夹

imageless -d

删除 imageless.json 文件

imageless -v

查看版本

imageless -r

还原压缩文件

配置

package.json 可进行 imageless 相关配置,以下为默认配置项

{
  "imageless": {
    "input": ["src/**/*.{jpg,jpeg,png}"],
    "jpegOptions": {
      "quality": 70
    },
    "pngOptions": {
      "quality": [0.6, 0.8]
    },
    "minSize": 1024,
    "tinifyKey": "YOUR_API_KEY"
  }
}

input

使用 globby 的 patterns 选项,可设置需要压缩的文件路径,也可过滤一些文件夹或文件 如 ["src/**/*.{jpg,jpeg,png}", "!src/images/user.jpg"]

tinifyKey

使用 tinify 压缩图片,配置 YOUR_API_KEY,默认使用作者申请的 key,每月限制500张,可设置为自己申请的 key

jpegOptions

使用 imagemin-mozjpeg 的 options,可设置 jpeg 格式图片压缩选项。quality设置压缩质量,范围 0 ~ 100,默认值 70

pngOptions

使用 imagemin-pngquant 的 options,可设置 png 格式图片的压缩选项。quality设置压缩质量,格式Array<min: number, max: number>,默认值 [0.6, 0.8]

minSize

大于等于 minSize 大小的图片才会被压缩,设置 0 所有的图片都压缩,默认 1KB