优化字体Awesome只为使用的类 [英] Optimize Font Awesome for only used classes

查看:92
本文介绍了优化字体Awesome只为使用的类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Font Awesome Sass文件 https://github.com/ FortAwesome / Font-Awesome / blob / master / sass / font-awesome.sass ,使它 _font-awesome.sass ,所以我可以 @import 在我的Sass项目。我也使用 http://middlemanapp.com/ Sass 转换为 Css 。问题:

I am using Font Awesome Sass file https://github.com/FortAwesome/Font-Awesome/blob/master/sass/font-awesome.sass to make it _font-awesome.sass so I can @import in my Sass project. I am also using http://middlemanapp.com/ to convert Sass to Css. Questions:


  1. 有没有办法只将使用的图标类因为现在它包含 _font-awesome.sass

奖金:使用使用的图标类以某种方式重新编译字体,使其在生产使用时更小?

BONUS: Is it possible to recompile the fonts somehow with used icon classes to make it smaller on production use?

$ b $

如果我能得到上述#1的一些提示,那就太棒了。

Thanks.

推荐答案

Sass不知道你实际使用的类。这是你必须手动修剪自己。打开提供的.scss文件,并删除任何你不需要的。

Sass has no idea what classes you are actually using. This is something you will have to manually trim down yourself. Open up the provided .scss file and hack out anything you don't need.

编辑字体文件本身以消除不需要的字形需要第三方应用程序执行,并且超出了此问题的范围。

Editing the font file itself to eliminate unneeded glyphs requires a 3rd party application to do so and is beyond the scope of this question.

Fontello 是一个在线网络服务,可以为您完成所有这些工作。它允许您在多个图标字体集合之间混合和匹配,以为您的项目创建完美的字体文件。除了定制的字体文件,它提供了多个.css文件包含已经为你生成的样式(更改扩展名为.scss将允许您将它们导入到现有的Sass项目)。

Fontello is an online web service that can do all of this for you. It lets you mix and match between multiple icon font collections to create the perfect font file for your project. In addition to the customized font file, it provides multiple .css files containing styles already generated for you (changing the extension to .scss will allow you to import them into your existing Sass project).

这篇关于优化字体Awesome只为使用的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆