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

svg2font-cmss

v1.0.3

Published

做这个工具是受https://github.com/MichealWayne/svgs2fonts的启发。介绍文档:http://blog.michealwayne.cn/2018/07/26/notes/%E3%80%90%E7%AC%94%E8%AE%B0%E3%80%91%E7%94%B1iconfont%E5%BC%95%E8%B5%B7%E7%9A%84svg%E3%80%81ttf%E3%80%81woff%E3%80%81woff2%E5%9B%BE%E6%A0%87%E7%9A%84%E7

Downloads

5

Readme

特别说明

做这个工具是受https://github.com/MichealWayne/svgs2fonts的启发。介绍文档:http://blog.michealwayne.cn/2018/07/26/notes/%E3%80%90%E7%AC%94%E8%AE%B0%E3%80%91%E7%94%B1iconfont%E5%BC%95%E8%B5%B7%E7%9A%84svg%E3%80%81ttf%E3%80%81woff%E3%80%81woff2%E5%9B%BE%E6%A0%87%E7%9A%84%E7%A0%94%E7%A9%B6%E5%8F%8A%E5%85%B6%E8%BD%AC%E6%8D%A2/

最开始是想找一个可以直接用的工具来生成fonts图标,当时找到svgs2fonts后感觉基本上也解决了问题,但是这个工具可以生成demo.html,但是项目中直接用却需要将demo.hmtl中的css拷贝出来,虽然很好,但还可以更好,查看源码之后发现并没有生成css的方法,当然也可以fork后二次开发,但是基于对github稳定性的不信任,还是决定在gitos上重新实现。

整体上的思路完全来自svgs2fonts, 但是具体代码实现完全是自主开发的,转换的代码来自各个依赖工具本身提供的代码。

生成css文件使用了less,这是一个很坑的东西,出错没有代码提示,基本就是在试错。内置函数各种问题,关键是外部传参,简直欲仙欲死。

生成demo.html使用了ejs,这个就比较友好了,没出什么幺蛾子。

依赖

svgicons2svgfont: 将多个svg文件合并成一个svgfont文件

svg2ttf: 将svgfont文件转换为ttf文件

ttf2eot: 将ttf文件转换为eot文件

ttf2woff: 将ttf文件转换为woff文件

ttf2woff2: 将ttf文件转换为woff2文件

less: 生成svgfont.css

ejs: 生成svgdemo.html

使用

工具已经上传npm,搜索'svg2font-cmss',就可以找到,使用1.0.2版本,前两个版本是测试的。

const svg2font = require('svg2font-cmss');


svg2font.build(svgPath,fontPath);