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 🙏

© 2025 – Pkg Stats / Ryan Hefner

wx-icon-cleaner

v0.0.2

Published

A tool for cleaning unused icons from WeChat Mini Programs.

Readme

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';
}
...