中文字体压缩工具-字蛛 使用总结

原理是将需要的文字提取出来,重新压缩。

  1. 1.下载node.js //这个没有任何难度,直接下载windows版本,安装即可

  2. 安装命令:npm install font-spider -g

  3. 新建一个font.css,复制下面代码(注意路径):

     /*声明 WebFont*/
     @font-face {
       font-family: 'pinghei';
       src: url('../font/pinghei.eot');
       src:
         url('../font/pinghei.eot?#font-spider') format('embedded-opentype'),
         url('../font/pinghei.woff') format('woff'),
         url('../font/pinghei.ttf') format('truetype'),
         url('../font/pinghei.svg') format('svg');
       font-weight: normal;
       font-style: normal;
     }
     
     /*使用选择器指定字体*/
     .home h1, .demo > .test {
         font-family: 'pinghei';
     }
    

4.在命令行中执行命令:font-spider *.html 生成对应的字体

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容