Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FontAwesome icon issue | FontAwesome 图标问题 #505

Closed
ivan-nginx opened this issue Dec 12, 2018 · 27 comments · Fixed by #1438
Closed

FontAwesome icon issue | FontAwesome 图标问题 #505

ivan-nginx opened this issue Dec 12, 2018 · 27 comments · Fixed by #1438

Comments

@ivan-nginx
Copy link
Member

ivan-nginx commented Dec 12, 2018

The icon library of the latest version of theme NexT has been migrated to FontAwesome 5. This change is not backward compatible, which means that the previous configuration for FontAwesome 4.7.0 will fail and the icons will not be displayed. If you have encountered related issues, please remove the customized icon and CDN link in the configuration file according to this Pull Request: #1438 .

最新版本的 NexT 主题迁移到了 FontAwesome 5。此改动不向下兼容,这意味着此前对于FontAwesome 4.7.0 版本的配置会失效,且导致图标无法显示。如果你遇到了图标问题,请根据此 Pull Request #1438 的更改,移除配置文件中自定义的图标和 CDN 链接,并重新进行配置。


Today i decided to update FontAwesome from v4 to v5 in accordance with #94 and #474
issues. Well, this was not hard and at least 2/3 icons was successfully shown. But! Trouble is happened (i know what Free and Pro versions – it's not simple way): free icons was very smoothly and some icons was not in their places (a little topped, a little bottomed)...
Firstly i think what i not set some options or something like that. I try many parameters – without luck. And what are you guys thinking? I'm going on FA site and saw randomed PRO icon; lets see on Book) or on Bullhorn icon. See and click on from Free to PRO version.
See this *hit? They specially make Free version more cloudy and PRO version more legibly. I compare NexT online site FA v4 to localhost with FA v5 – FA v4 looks like icons in PRO version.

So, as FA can't upgrade anymore, i suggest to switch on Material Design Icons (Google).

Let's compare icons number:

  • FA v4.7.0 – 675 icons.
  • MDI latest version – 2,346 icons (if i right understand). Of cource, mb icons repeated like FA (transparent / not), but anyway if 2,346 / 3 = 782.

Let's compare pack weight:

  • FA v4.7.0 – 429 kb.
  • MDI latest version – 5,3 mb.

What do you thinking, guys? I can soon switch from FA to MDI and up on test domain to see how they looks. If icons will better, we can totally switch on MDI (they, by the way, periodically add icons to main pack):

19 New Icons.
Latest commit 22874e5  4 days ago

Other Information

@maple3142
Copy link
Contributor

Perhaps iconmoon will be a good solution, it support lots of iconpacks including FA4 and MDI, and it enable you to select icons you need.
Otherwise, I don't think 5.3mb is suitable for web at all.

@ivan-nginx
Copy link
Member Author

ivan-nginx commented Dec 12, 2018

@maple3142 this? There are 490 icons with free license.

Otherwise, I don't think 5.3mb is suitable for web at all.

This is full pack. CSS weight about ~137 kb (FA was ~30 kb). See:

image

Mb SVG file (3.5 mb) not need, how you think? BTW, i cutted FA too from version 5 to version 6, when we do rebase.

Total weight MDI with normal work about ≈ 1 mb (FA ≈ 500 kb). So? Icons x3 more. See here for details.

@maple3142
Copy link
Contributor

The website I provided (icomoon) can also offer both FA & MDI, and you just need to select what icon you need then pack it as a new icon font.
With this, it can significantly reduce the size of icon font and provide multiple icon fonts.

@ivan-nginx
Copy link
Member Author

Oooh! I see. Icomoon App at the right top corner. Ok, i'll try it.

@ivan-nginx
Copy link
Member Author

ivan-nginx commented Dec 12, 2018

Well, @maple3142, FA + MDI splitted ≈ 1.6 mb.
And don't have woff2, which is do faster rendering on modern browser:
image

@maple3142
Copy link
Contributor

The reason of using these icon pack is is smaller icon pack size, so you wouldn't want to use it if you simply select all icons.
As for woff2, only premium version can generate it, and there is some free alternatives such as fontello(I currently use it in my site.).

@jiangtj
Copy link
Member

jiangtj commented Dec 13, 2018

@maple3142 If only select next using icon, how to change icon. Regenerate iconmoon pack? This may be a bit of trouble.

@ivan-nginx ivan-nginx pinned this issue Dec 13, 2018
@ivan-nginx ivan-nginx unpinned this issue Dec 13, 2018
@ivan-nginx ivan-nginx pinned this issue Dec 13, 2018
@ivan-nginx
Copy link
Member Author

@jiangtj @maple3142 i already find solution: 3rd-party icons (except FA) will be used as external modules, like Fancybox. Feature will be ASAP.

@stevenjoezhang
Copy link
Contributor

stevenjoezhang commented Dec 27, 2018

I think font-awesome v5 is OK, at least it's working fine on my site (https://zhangshuqiao.org), and it's easy for users to update their settings. If we use some other 3rd-party icons instead, there would be several parts need to rewrite in _config.yml

2019-01-03 3 39 23
2019-01-03 3 39 40

Should notice that:

Outline Style Icons - Similarly, all icons that had an outlined style (and usually ended with -o) now have a prefix of far and have had their -o suffix removed.

See: https://fontawesome.com/how-to-use/on-the-web/setup/upgrading-from-version-4
And the default font-size in v5 seems larger than v4

In layout/_partials/post/post-copyright.swig
fa fa-fw fa-creative-commons -> fab fa-fw fa-creative-commons

@stevenjoezhang
Copy link
Contributor

And I found that fontawesome v5 conflict with han...

@ivan-nginx
Copy link
Member Author

@stevenjoezhang where is conflict?

@stevenjoezhang
Copy link
Contributor

stevenjoezhang commented Dec 29, 2018

@ivan-nginx I found this in source/css/_common/components/third-party/han.styl:

i.fa { font-family: FontAwesome !important; }

Because han.css will override all the font-family settings, it's necessary to use !important to declare the font-family of font-awesome icons.
But the font name is changed in v5, so it's necessary to update the font name:

i.fa, i.far, i.fas {
    font-family: "Font Awesome 5 Free" !important;
}

or

i.fa, i.far, i.fas {
  font-family: FontAwesome, "Font Awesome 5 Free" !important;
}
i.fab {
  font-family: "Font Awesome 5 Brands" !important;
}

@ivan-nginx
Copy link
Member Author

Ok, let's make this issue into Low Priority. For now we need to resolve #547 pull with cache generation (High Priority).

@JOduMonT
Copy link

if I may; ForkAwesome propose a good alternative of Font-Awesome 5
Have extra icons and keep the old way of calling these icon such as : <i class="fa fa-camera-retro"></i>

@1v9
Copy link
Member

1v9 commented Mar 16, 2019

@JOduMonT I've tested and it's prety good.

@Aqua-Dream
Copy link

Any progress? Does closing this issue mean there is no plan to update yet?

@jiangtj
Copy link
Member

jiangtj commented Mar 17, 2020

reopen... planning to upgrade v5?

@stevenjoezhang
Copy link
Contributor

stevenjoezhang commented Mar 17, 2020

The best way is to find a tool that can generate and package fonts locally. This way users can always use the icons they want and avoid loading the entire font awesome icon library (it's too big even for CDNs).

Font Awesome 5 is about 200kb in total. It's acceptable.

@jiangtj
Copy link
Member

jiangtj commented Mar 17, 2020

The best way is to find a tool that can generate and package fonts locally.

This is possible, but requires npm

e.g. https://github.com/hexojs/hexo-fontawesome, we can use this plugin to convert to svg.

Although hexo plans to support npm installation themes, this will make users have to install the theme through npm or do some extra steps to install dependencies in order to use the theme they have cloned.

GitHub
A utility function which helps to inline fontawesome SVG files. - hexojs/hexo-fontawesome

@stevenjoezhang
Copy link
Contributor

stevenjoezhang commented Mar 29, 2020

hexo-fontawesome cannot handle dynamically loaded icons. We may need to develop a plugin based on this module: https://www.npmjs.com/package/webfont

I plan to split it into two steps:

  • migrate to font awesome5,
  • and then develop a plugin to allow users to package only the required icons and reduce the size of the woff2 font
npm
Generator of fonts from svg icons, svg icons to svg font, svg font to ttf, ttf to eot, ttf to woff, ttf to woff2

@stevenjoezhang stevenjoezhang pinned this issue Mar 30, 2020
@stevenjoezhang stevenjoezhang changed the title About FontAwesome FontAwesome icon issue | FontAwesome 图标问题 Mar 30, 2020
@sli1989 sli1989 unpinned this issue Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants