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

@tenado/svg2font

v1.0.13

Published

根据svg生成字体图标库,可以内置在项目中的脚手架工具

Downloads

6

Readme

介绍

svg2font, 根据 svg 生成字体图标库,可以内置在项目中的脚手架工具

使用

1、安装

# 安装依赖
npm install @tenado/svg2font -D

或

yarn add @tenado/svg2font -D

2、初始化

执行如下命令,会在项目目录下生成一个svg2font.config.js文件,里面记录了脚本执行时候需要的配置

npx svg2font init

3、配置 svg2font.config.js

| 参数 | 说明 | 默认值 | 是否可选 | | ----------- | ---------------------------------------------------------------------- | ---------- | -------- | | inputPath | svg 文件夹路径 | ~ | 必填 | | outputPath | 生成字体文件存放位置 | ~ | 必填 | | fontFamily | 字体的名称 | tenadoIcon | 可选 | | fontPrefix | 字体的前缀 | ticon- | 可选 | | ejs | 生成 icon 列表页面的模板,默认使用系统的,如果需要自定义,则设置该选项 | ~ | 可选 | | examplePath | 生成静态文件存放的位置,位置应与 outputPath 在同一目录下 | ~ | 可选 | | examplePort | 查看静态文件的端口 | ~ | 可选 | | exampleRun | 是否启动 example 的静态页面 | true | 可选 |

svg2font.config.js 的默认配置如下:

{
  "inputPath": "src/assets/svgs",
  "outputPath": "src/assets/font",
  "fontFamily": "tenadoIcon",
  "fontPrefix": "ticon-"
}

4、转换 svg 成字体文件

npx svg2font sync

5、项目 main 文件中引入字体文件 css

// src/main.js
import "./src/assets/font/index.min.css";

6、在项目中使用字体图标

使用 i 或者 span 标签,且把 svg 名称作为类名,例如<span class="ticon-color-pick"></span>

7、查看当前项目的 icon 列表

更改配置文件 svg2font.config.js,向里面加入 examplePath 和 examplePort,这里注意 examplePath 应尽量与 outputPath 在同一目录下

npx svg2font example