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 🙏

© 2026 – Pkg Stats / Ryan Hefner

wx-icon-cleaner

v0.0.3

Published

A tool for cleaning unused icons from WeChat Mini Programs.

Downloads

37

Readme

wx-icon-cleaner

⚠️ 停止维护声明

⚠️ 警告:该包已不再维护!请迁移至 @mp-svg-icons/utils


⚠️ 迁移指南

本包 wx-icon-cleaner 已停止维护,不再更新。请改用 @mp-svg-icons/utils

npm install @mp-svg-icons/utils

差异说明

| | wx-icon-cleaner(旧) | @mp-svg-icons/utils(新) | | --- | --- | --- | | 功能 | 仅清理未使用的 iconfont 图标样式 | iconfont 图标裁剪 + SVG 图标裁剪 | | 支持平台 | 仅微信小程序 | 微信、支付宝、百度、抖音、快手、小红书、京东等 | | 支持组件库 | 仅 tdesign-miniprogram | tdesign-miniprogram、@vant/weapp 及其他 iconfont 组件库 | | 图标扫描 | 手动配置 usedIcons 列表 | 自动扫描项目目录,智能识别已使用图标 | | 配置文件 | 支持 wx-icon-cleaner.config.js/json | 不再需要配置文件,通过 CLI 参数传递 | | 使用方式 | CLI + Node API | CLI(npx mp-iconfont-clear)+ 编程调用 | | 预览模式 | 不支持 | 支持 --dry-run 预览裁剪结果 |

💡 提示@mp-svg-icons/utils 不再支持配置文件,所有参数通过 CLI 选项或编程接口传入。

迁移示例

旧方式(wx-icon-cleaner):

// wx-icon-cleaner.config.js
module.exports = {
  classPrefix: 't',
  inputFile: './miniprogram_npm/tdesign-miniprogram/icon/icon.wxss',
  usedIcons: ['home', 'close', 'check-circle']
};
npx wx-icon-cleaner --config ./wx-icon-cleaner.config.js

新方式(@mp-svg-icons/utils):

# 自动扫描项目目录,识别已使用图标并裁剪
npx mp-iconfont-clear \
  --pkg-dir ./miniprogram_npm/tdesign-miniprogram \
  --scan ./pages ./components

# 或手动指定要保留的图标
npx mp-iconfont-clear \
  --pkg-dir ./miniprogram_npm/tdesign-miniprogram \
  --icons home,close,check-circle

如有问题,请前往新包仓库提交 Issue:miniprogram-svg-icons


、、

wx-icon-cleaner

A tool for cleaning unused icons from WeChat Mini Programs.

背景

微信原生小程序引入第三方 UI 组件库时,图标样式通常会被全量引入,造成大量图标样式冗余。wx-icon-cleaner 正是在此背景下诞生,一个用于清理实际未使用图标的工具。

使用

安装

npm i --save-dev wx-icon-cleaner

命令执行

# 在当前目录初始化配置文件,js/json
npx wx-icon-cleaner init
# or 在指定目录初始化配置文件
npx wx-icon-cleaner init ./some/directory

# 过滤未使用图标,默认读根目录下 wx-icon-cleaner.config.js/json 文件
npx wx-icon-cleaner --config ./icon-cleaner.config.js

配置文件

// 项目根路径下创建 wx-icon-cleaner.config.js 配置文件
module.exports = {
  classPrefix: 't', // 仅处理 t-icon 开头的图标,非 t-icon 开头的图标默认保留。默认值 t
  inputFile: './miniprogram/miniprogram_npm/tdesign-miniprogram/icon/icon.wxss', // 目标文件相对路径路径
  outputFile: '' // 输出文件路径,若未提供,默认覆盖目标文件路径
  usedIcons: ['accessibility-filled', 'app'] // 已使用图标组
};

在 Node 中使用

const WxIconCleaner = require('wx-icon-cleaner');
const config = require('./wx-icon-cleaner.config.js');

const iconCleaner = new WxIconCleaner(config);

iconCleaner
  .iconCleaner()
  .then(() => {
    console.log('Process completed successfully!');
  })
  .catch((error) => {
    console.error('An error occurred:', error.message);
  });

效果

以 tdesign-miniprogram 为例,假如业务实际使用 60 个图标。源图标样式文件 98kb,wx-icon-cleaner 清理后,图标样式文件降低到 4kb)

/* 最终目标样式文件进保留常规样式类和已使用图标类 */
@import '../common/style/index.wxss';

@font-face {
  font-family: t;
  src: url(https://tdesign.gtimg.com/icon/0.3.1/fonts/t.eot),url(https://tdesign.gtimg.com/icon/0.3.1/fonts/t.eot?#iefix) format('ded-opentype'),url(https://tdesign.gtimg.com/icon/0.3.1/fonts/t.woff) format('woff'),url(https://tdesign.gtimg.com/icon/0.3.1/fonts/t.ttf) format('truetype'),url(https://tdesign.gtimg.com/icon/0.3.1/fonts/t.svg) format('svg');
  font-weight: 400;
  font-style: normal;
}

.t-icon--image {
  width: 100%;
  height: 100%;
}

.t-icon__image {
  vertical-align: top;
  width: 100%;
  height: 100%;
}

.t-icon-base {
  font-style: normal;
  font-weight: 400;
  font-variant: normal;
  text-transform: none;
  line-height: 1;
  text-align: center;
  display: block;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.t-icon {
  font-family: t!important;
}

.t-icon-accessibility-filled:before {
  content: '\E001';
}

.t-icon-app:before {
  content: '\E027';
}
...