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

minpic

v1.2.2

Published

图片压缩工具

Downloads

12

Readme

minpic

图片压缩工具

Description

tinypng拥有最好的图片无损压缩服务,但官方api较简单,只能压缩单个图片,且单账号每月只能免费压缩500张,该工具可进行批量压缩,并且超出500张后自动切换账号。

该工具更适合团队使用,可将minpic集成到团队内部的构建工具中,团队注册并共享多个账号,代码发布前进行图片压缩,优化前端性能。

First

https://tinypng.com/developers

使用邮箱创建账号,并获取API KEY

Install

$ npm install minpic --save-dev

Usage(webpack)

const minpic = require('minpic');

const webpackConfig = {
    plugins: [
        new minpic()
    ]
}

Options

  • disabled 禁用, 默认 false
  • keyFilePath 存放key的文件路径,默认系统根目录/.minpic.json
  • cacheFilePath 存放图片压缩信息的文件路径,默认项目根目录/.minpic.txt
  • force是否强制压缩图片,默认false

Callback

  • init 项目启动时的初始化方法
  • completeOnce({now, all}) 每当图片压缩完成一次后,就会调用一次
  • success 所有图片压缩完成后调用
  • error 所有key都达到上限后调用该方法

Tips

  1. minpic不会压缩.gitignore中设置的目录
  2. minpic会记录压缩信息,不会重复压缩
  3. 当前账号压缩达到上限时,minpic会自动切换账号