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

tinypng-plugin

v1.0.2

Published

基于 node + tinify + typescript 实现自动批量图片压缩。

Downloads

2

Readme

插件描述

基于 node + tinify + typescript 实现自动批量图片压缩。

安装插件

| 安装方式(通过 npm 安装) | 命令 | | ----------------------- | ----------------------- | | 本地安装 | npm i tinypng-plugin -D | | 全局安装 | npm i tinypng-plugin -g |

引入组件

  • 本地安装

    在你的文件根目录创建执行文件如:tinyPngStart.js。

    require("tinypng-plugin")
  • 全局安装

    无需引入

配置插件

* 由于该插件是基于 tinify,所以使用该插件需要一些基础配置。

| 参数名 | 说明 | 格式 | | ------ | ------ | ------------------------------------------------------------ | | type | 非必传 | 正则表达式的模式;如:\.(png | jpg | gif | jpeg | webp) | | key | 必传 | 多个 key 需要用管道符 | 分割;如: key1|key2|key3 |

1.通过在项目根目录创建配置文件 .tinypng.config 设置插件依赖配置。

type=\.(png|jpg)
key=key1|key2|key3

2.通过命令行设置插件依赖配置。

全局安装:
tinypng --key="key1|key2|ke3" --type="\.(jpg)"

本地安装:
node tinyPngStart.js  --key="key1|key2|ke3" --type="\.(jpg|png)"

运行插件

** TODO: 该插件会在你的根目录生成日志文件 tinypng-success.log,仅供使用者参考,如果你不想版本控制该文件,可以在.gitignore 做忽略。**

  • 本地安装

    • 有配置文件

      命令行输入:node tinyPngStart.js

    • 无配置文件

      命令行输入:node tinyPngStart.js --key="key1|key2|key3"

  • 全局安装

    • 有配置文件

      命令行输入:tinypng

    • 无配置文件

      命令行输入:tinypng --key="key1|key2|key3"

插件目录


|-- tinypng-plugin
    |-- .gitignore          #Git提交规则
    |-- .npmignore          #发布到npm时的排除文件规则
    |-- package-lock.json          #锁定安装时的包的版本号
    |-- package.json          #项目基础配置
    |-- README.md          #项目说明文件
    |-- tsconfig.json          #typescript基础配置文件
    |-- bin          #全局命令
    |-- lib          #编译后生成的文件目录
    |   |-- index.d.ts
    |   |-- index.js
    |   |-- common
    |   |   |-- index.d.ts
    |   |   |-- index.js
    |   |   |-- state.d.ts
    |   |   |-- state.js
    |   |-- utils
    |       |-- types.d.ts
    |       |-- types.js
    |-- src          #源文件
        |-- index.ts          #入口文件
        |-- common          #公用类
        |   |-- index.ts          #公共方法类
        |   |-- state.ts          #全局状态
        |-- utils          #工具类函数
            |-- types.ts          #类型检测工具