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

package-icons

v0.0.9

Published

command line tool to package svg icons into font file with useable css

Downloads

36

Readme

package-icons

package-icons is a command line tool to package svg icons into font file with useable css

简介

我们在开发的时候,UI大大会不停更新svg矢量图标,所以我们一次又一次地手动用 panda 这个工具来更新图标的字体库。来一个,更新一次;来两个,更新一双;来三个……擦!终于有一天,见勇怒了(不要问我见勇是谁),总不能打UI大大(说不定也打不过……),于是就打(写)了这个小工具。

使用这个小工具,我们需要的东西有:

1. 一个装满svg文件的文件夹
2. 每个svg文件都做好英语命名,例如: action-search.svg, action-cancel.svg

运行后,我们得到的东西有:

1. eot/svg/ttf/woff 字体文件
2. css文件(所有的图标class名会根据svg文件名生成)
3. 预览用的html文件

理论上,配合脚本,这些woff和css可以直接在项目中使用,显示漂亮的图标。

UI大大每次发过来一个svg的zip包,见勇微微一笑,运行脚本。

就这样,世界和平了……

Install and run

Please make sure you have Node 8+ installed.

npm install -g package-icons
package-icons

if you get npx installed, try

npx package-icons

Alt text

Example

  1. Given you have a folder like below

    Alt text

  2. Then you can run

    npx package-icons \
    --source /Users/lujunjie/code/github/gfsfe/package-icons/test/icons  \
    --target /Users/lujunjie/code/github/gfsfe/package-icons/test/target \
    --class-prefix w-icon-
  3. You will get the result in the target folder like below

    Alt text

  4. You can double click the preview.html to see the result.

    Alt text

  5. There is a icon-meta.json which contain the meta information of the class name and font value, you can use it to generate project final css with predefined template in your project's build flow.

    {
        "w-icon-add": "e001",
        "w-icon-close": "e002",
        "w-icon-delete": "e003",
        "w-icon-done": "e004",
        "w-icon-left": "e005",
        "w-icon-right": "e006",
        "w-icon-share": "e007",
        "w-icon-win": "e008"
    }