npm install font-spider -g
hyheilizhitij (Hanyi black lychee script)
// import
@font-face{
font-family: 'myfont';
src:url('./fonts/HYHeiLiZhiTiJ.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
//use
.test{
font-family: 'myfont';
}
Run the font-spider command, the page-dependent fonts will be automatically compressed, and the original .ttf fonts will be backed up
font-spider ./index.html
//Original size: 1753.24 KB File fonts/HYHeiLiZhiTiJ.ttf created: 4.796 KB
//Effect
//complete code
<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>