Using font-awesome in ionic 2

前端 未结 6 1483
独厮守ぢ
独厮守ぢ 2020-12-14 09:31

How can i use fontawesome with ionic 2, i\'ve following this tutorial but it\'s not working.

6条回答
  •  渐次进展
    2020-12-14 09:54

    I tried most of the answers above but they were either too complicated or had a limitation when the core of Ionic2 was upgraded so here is my solution:

    It requires manually upgrading of FA when a new version comes out but I don't need to upgrade often as I only use a few select icons.

    Ignore the SASS files and copy the contents of \node_modules\font-awesome\fonts to \src\assets\fonts. Also copy \node_modules\font-awesome\css\font-awesome.min.css to the same place.

    Reference the csss in your index.html file like this:

      
      
      
      
    

    Then to use it, put this into the page's scss:

      .logo-text {
        font-family: 'comfortaa-bold';
      }
    

    and this in the html:

    Come bien a la mitad de precio

    And that should be it...

提交回复
热议问题