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

nodejs-svgs2font

v1.0.1

Published

svgicons编译字体

Readme

svg图标编译成font

项目介绍

svg图标,编译成字体,包含svg、ttf、eot、woff 支持生成css,如果css有内容,会放置在内容最前面

建议全局安装

npm i @liepin/nodejs-svgs2font -D

使用方法

字体存放:把一个个svg字体放置在文件夹里

const svgsFont = require('@liepin/nodejs-svgs2font');
const path = require('path');

// 字体图标默认属性
svgsFont({
  fontName: 'iconfont', // 字体名称
  baseClass: 'text-icon', // 基础css类
  classPrefix: 'icon-', // 图标css前缀
  files: path.resolve(process.cwd(), 'icons'), // svg path
  output: path.resolve(process.cwd(), 'fonts'), // output path
  cssPath: path.resolve(process.cwd(), '/font.css'), // css文件
  publicPath: '../fonts', // 当使用less的@import时,出现找不到字体文件时,可以手动传入文件夹相对路径
  successLog: true, // 是否展示成功日志
});

另一种用法

svgsFont({
  fontName: 'iconfont', // 字体名称
  baseClass: 'text-icon', // 基础css类
  classPrefix: 'icon-', // 图标css前缀
  files: [
    '', // 每一个svg图标的绝对地址,满足可以传入不同地方的svg
  ], // svg path
  output: path.resolve(process.cwd(), 'fonts'), // output path
  cssPath: path.resolve(process.cwd(), '/font.css'), // css文件
  publicPath: '', // 当使用less的@import时,出现找不到字体文件时,可以手动传入文件夹相对路径
  successLog: true, // 是否展示成功日志
  svgicons2svgfont: {
    // svgicons2svgfont 插件的options, 请参考https://www.npmjs.com/package/svgicons2svgfont
  },
  svg2ttf:{
    // svg2ttf 插件的options, 请参考https://www.npmjs.com/package/svg2ttf
  }
});

特殊说明:由于生成的ttf、eot、woff,是写入当前时间戳,所以每次都会变化 可以传入一个固定的时间戳,替换当前的时间戳

  {
    svg2ttf:{
      ts: 1552532400 // Unix timestamp (in seconds) to override creation time (optional)
    }
  }

日志

1.0.0 增加命令行编译 svgTofont -v