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

@maxtan/iconfont

v1.0.2

Published

基于Node环境的字体生成器,可通过命令行将svg文件批量生成字体

Downloads

42

Readme

SVG 转换字体工具

全局安装

npm install @maxtan/iconfont -g

或者使用 yarn:

yarn add @maxtan/iconfont -g

使用

直接编译文件夹所有文件

编译 svgs 目录下所有的 svg 文件 ,默认会递归查找所有 .svg 文件

iconfont ./svgs

自定义字体 icon 名

可以配置样式类和文件名的 icon

iconfont ./svg -n icon

配置输出目录

项目默认输出命令的 dist 目录,如果没有,会自动创建,通过 -o 参数你可以指定项目目录

iconfont ./svg -o dist

使用自定义的 js 模板

你可以自定义使用 symboljs 模板,模板语法使用的是loadsh 模板语法,如果不指定 js 模板资源,则使用默认的系统 JS 模板

iconfont ./svg -o dist -jstpl ./a.tpl

使用自定义的 css 模板

你可以自定义使用的 css 模板,模板语法使用的是loadsh 模板语法,如果不指定 css 模板资源,则使用默认的系统 CSS 模板

iconfont ./svg -o dist -csstpl ./b.tpl

生成规则

字符编码起始位0xe001 会读取文件命名自动计算,理论上来说,只要保证文件名不变,每次生成的对应字体编码都是一致的

生成的目录结构

  • dist
    • iconfont.css -- 需要导入到项目的 css 文件
    • iconfont.eot -- 需要导入到项目的 eot 文件
    • iconfont.html -- 预览的网页 方便查询有哪些字体图标,及使用方法
    • iconfont.js -- 需要导入到项目的 js 文件,用以支持 Symbol 使用
    • iconfont.svg -- 需要导入到项目的 svg 文件
    • iconfont.ttf -- 需要导入到项目的 ttf 文件
    • iconfont.woff -- 需要导入到项目的 woff 文件
    • iconfont.woff2 -- 需要导入到项目的 woff2 文件
    • iconfontdemo.css -- 预览网页的基础 css 文件,不需要导入到项目