1.0.3 • Published 6 years ago
fontparsing v1.0.3
fontparsing
fontparsing是一个根据字体文件解析生成对应字体图标文档,可以用fontparsing来生成对应字体文件的字体图标CSS,使用简单。
INSTALL
npm install fontparsing --sava
使用
const fontPaser = require('fontparsing');
const path = require('path');
// 配置编译
fontPaser({
// 入口字体文件
entry:path.resolve(__dirname, 'font/iconfont.ttf'),
// 编译出来的css及html路径
output:{
path:path.resolve(__dirname, 'dist'),
filename: 'test',
className:'test-icon'
}
});
配置好选项,node执行,生成对应的文件
├── dist
│ ├── test.css
│ └── test.html
├── font
│ ├── iconfont.eot
│ ├── iconfont.ttf
│ ├── iconfont.woff
│ └── iconfont.woff2
└── index.js
配置代码写在Index.js
Test
先确保安装依赖包 npm install 再运行npm test 之后访问 ./test/dist/test.html
API
fontPaser({
// 入口字体文件
entry:path.resolve(__dirname, 'font/iconfont.ttf'),
// 编译出来的css及html路径
output:{
// 生成文件目录地址
path:path.resolve(__dirname, 'dist'),
// 生成的文件名
filename: 'test',
// 生成CSS的字体图片class名称
className:'test-icon'
}
});
Keywords
字体文件解析、字体文件生成CSS
交流分享
QQ群:323750798