百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
F

font-spider-plus

> 编程语言
开源

font-spider-plus(字蛛+)是一个智能 WebFont 压缩工具,它能自动分析出本地页面和线上页面使用的 WebFont 并进行按需压缩。

736 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

font-spider-plus(字蛛+)是一个智能 WebFont 压缩工具,它能自动分析出本地页面和线上页面使用的 WebFont 并进行按需压缩。

字蛛+(Font-spider-Plus)

font-spider-plus(字蛛+)是一个智能 WebFont 压缩工具,它能自动分析出本地页面和线上页面使用的 WebFont 并进行按需压缩。

特性

除了兼容font-spider(字蛛)支持的特性:

  1. 压缩字体:智能删除没有被使用的字形数据,大幅度减少字体体积
  2. 生成字体:支持 woff2、woff、eot、svg 字体格式生成

font-spider-plus(字蛛+)还具有以下特性:

  1. 支持线上动态渲染的页面
  2. 支持线上GBK编码的文件

安装

bash
    npm i font-spider-plus -g

使用范例

一、书写 CSS

出自:font-spider中文文档

css
/*声明 WebFont*/
@font-face {
  font-family: 'source';
  src: url('../font/source.eot');
  src:
    url('../font/source.eot?#font-spider') format('embedded-opentype'),
    url('../font/source.woff2') format('woff2'),
    url('../font/source.woff') format('woff'),
    url('../font/source.ttf') format('truetype'),
    url('../font/source.svg') format('svg');
  font-weight: normal;
  font-style: normal;
}

/*使用指定字体*/
.home h1, .demo > .test {
    font-family: 'source';
}

特别说明: @font-face 中的 src 定义的 .ttf 文件必须存在,其余的格式将由工具自动生成

二、压缩本地WebFont

bash
fsp local [options] 

特别说明:htmlFile支持通配符,例如*.htm,*.shtml

三、压缩URL中的WebFont

1、初始化fspconfig文件

bash
fsp init 

在根目录下生成fspconfig.js文件

2、完善fspconfig.js文件

javascript
{
    /**
     * 本地font存放路径
     * @type    {String}
     */
    "localPath" : "../font/",
    /**
     * 线上字体文件路径 (网址中样式文件内font-family的src路径)
     * @type    {String}
     */
    "onlinePath" : "../font/",
    /**
     * URL
     * @type    {Array}
     */
    "url" :  [
    "http://ieg.tencent.com/",
    "http://game.qq.com/"
     ]
}

3、执行

bash
fsp run

示例文件下载: Demo.zip

相关链接

  • 字蛛
  • 字蛛API

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

JavaScript

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言