font-spider利器对webfont网页字体压缩使用

http://font-spider.org/

npm install font-spider -g

hyheilizhitij(汉仪黑荔枝体简)

//引入

@font-face{
            font-family: 'myfont';
            src:url('./fonts/HYHeiLiZhiTiJ.ttf') format('truetype');
            font-weight: normal;
            font-style: normal;
        }

//使用

.test{
            font-family: 'myfont';
        }

运行font-spider命令 ,页面依赖的字体将会自动压缩好,原 .ttf 字体会备份

font-spider ./index.html

//Original size: 1753.24 KB File fonts/HYHeiLiZhiTiJ.ttf created: 4.796 KB

//效果

//完整代码

<div class="test">
        账号未登录,请先登录的分身乏术地方发送
    </div>
    <style>
        @font-face{
            font-family: 'myfont';
            src:url('./fonts/HYHeiLiZhiTiJ.ttf') format('truetype');
            font-weight: normal;
            font-style: normal;
        }
        .test{
            font-family: 'myfont';
        }
    </style>

猜你喜欢

转载自www.cnblogs.com/fozero/p/8953288.html
今日推荐