font-spider 介绍
font-spider是 一个 智能 自动 化压缩工具,它能 自动 分析 页面 使用的 WebFont 并进行按需压缩,并不需要指定字体与字符。 ?
特性
压缩字体:智能 删除 没有被使用的字形数据,大幅度减少字体体积
生成 字体: 支持 woff2、woff、eot、svg 字体格式 生成
安装
npm install font-spider -g
一、书写 css
/*声明 WebFont*/@font-face {font-family: 'source';src: url('font/source.eot');src:url('font/source.eot?#font-spider') format('em bed ded-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: nor mal;font-style: nor mal;}/*使用指定字体*/.home h1,.demo > .test {font-family: 'source';}特别说明: @font-face 中的 src 定义的 .ttf 文件 必须存在,其余的格式将由工具 自动 生成二、压缩 WebFont
font-spider [options] <htmlFile1 htmlFile2 ...>htmlFiles
一个 或多个 页面地址 , 支持 http 形式。
options-h,--help 输出 帮助信息
-V,--version 输出 当前版本号
--info 输出 WebFont 的 jsON 描述信息,不压缩与转码
--ig nor e <pattern> 忽略的 文件 配置( 支持 正则表达式)
--map <remotePath,localPath> 映射 css 内部 HTTP 路径到本地( 支持 正则表达式)
--no-backup 关闭 字体备份 功能
--debug 调试模式,打开它可以 显示 css 解析 错误
网站地址 : http://font-spider.org
GitHub: https://github.com/aui/font-spider
网站描述: 一个 智能 WebFont 压缩工具
font-spider官方网站
官方网站: http://font-spider.org
如果觉得 网站内容还不错,欢迎将 网站 推荐给程序员好友。
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did176506