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

taro-iconfont-svg-cli

v1.1.4

Published

Taro SVG iconfont component generator - 让Taro也能使用阿里矢量图标库的SVG

Readme

本仓库源码出自taro-iconfont-cli,由于原仓库无人维护合并pr,所以本人基于 taro-iconfont-cli 自己维护这套源码,欢迎大家一起维护,有问题可以提 issue,我会尽快解决。

灵感来源:taro-iconfont-cli

通过 background:url(data:svg+xml....) 的形式 在小程序上把svg显示出来,目前在公司内部开发中得到实际应用。

image.png

试验田请访问:taro-test-iconfont-svg

支持平台

  • 微信小程序

支持框架

  • React

用法

npm 安装

npm install taro-iconfont-svg-cli -D

也可使用 pnpm 安装

pnpm install taro-iconfont-svg-cli -D

初始化 iconfont.json 文件

执行 npx iconfont-init 初始化配置

此时项目根目录会生成一个iconfont.json的文件,内容如下:

{
  "symbol_url": "请参考README.md,复制 http://iconfont.cn 官网提供的JS链接",
  "parse_remote_iconfont": true,
  "parse_local_svg": false,
  "local_svg_dir": "./src/assert/svg",
  "save_dir": "./src/components/iconfont",
  "default_icon_size": 18,
}

填上阿里矢量图标的svg地址(symbol_url)

symbol_url

请直接复制iconfont官网提供的项目链接。请务必看清是.js后缀而不是.css后缀。如果你现在还没有创建iconfont的仓库,那么可以填入这个链接去测试:http://at.alicdn.com/t/font_1373348_kk9y3jk2omq.js

注意:parse_remote_iconfont 设置为 false 时,此字段不是必需的。

parse_remote_iconfont

是否解析阿里远程 iconfont 图标。设置为 false 时,将跳过远程图标的获取,只处理本地 SVG 文件。

save_dir

根据iconfont图标生成的组件存放的位置。每次生成组件之前,该文件夹都会被清空。

default_icon_size

我们将为每个生成的图标组件加入默认的字体大小,当然,你也可以通过传入props的方式改变这个size值。

parse_local_svg

是否开启本地svg文件解析

local_svg_dir

本地svg文件存放文件夹的地址

生成自定义组件

执行 npx iconfont-taro 生成自定义组件iconfont

最后在项目中引入新生成的IconFont组件即可

IconFont 组件

| 参数 | 类型 | 说明 | 默认值 | |:----------------|:------------------|:---------------------------------|:----| | name | string | 阿里矢量图标Symbol名称,字段唯一表示,必须唯一 | - | | size | number | 图标字体大小 | - | | color | string | string[] | 图标颜色,如果图标有多个色块,请十六进制颜色字符串组成的数组表示 | - | | customStyle | CSSProperty | 自定义行内样式style | - | | customClassName | string | 自定义样式class类名 | - |