font-spider 安装及使用

开源世界 3 年前 回复

, ,

需要安装node.js

npm install font-spider -g 安装字蛛(由于字蛛网已经挂了,这个命令已经失效,甚是可惜)

好在他的GitHub资源还在,大家到https://github.com/aui/font-spider这里下载文件,在bin文件夹下,直接font-spider *.html或者font-spider 文件所在目录下的*.html即可将你的网页上的字体转换。

可能会报很多错

检查是否安装完成

font-spider --version

打包: doc命令进入目录所在位置 然后font-spider *.html或者font-spider 文件所在目录下的*.html

webfont字体使用:

@font-face {
  font-family: 'source';
  src: url('../font/source.eot');
  src:
    url('../font/source.eot?#font-spider') format('embedded-opentype'),
    url('../font/source.woff2') format('woff2'),
    url('../font/source.woff') format('woff'),
    url('../font/source.ttf') format('truetype'),
    url('../font/source.svg') format('svg');
  font-weight: normal;
  font-style: normal;
}

.home h1, .demo > .test {
    font-family: 'source';
}

注:引入文件因为ttf 类似otf会找不到文件

支付宝打赏微信打赏

如果此文对你有帮助,欢迎打赏作者。

发表评论

欢迎回来 (打开)

(必填)