晏溪
技术
使用font-slice对霞鹜文楷字体进行切片加载
霞鹜文楷字体ttf文件蛮大的,直接在网页中应用效果不太好,通过切片按需加载字体可以大幅优化加载速度。字体Github地址对字体进行切片操作步骤# 创建文件夹 mkdir font && cd font # 安装依赖 pnpm add -D font-slice # 创建执行文件 vim index.js # 赋予执行权限 chmod +x index.js # 运行 node ./index.jsindex.js内容const path = require('path'); const createFontSlice = require('font-slice')...
最近评论