Fontawesome is not working when project is built with grunt

前端 未结 15 1182
余生分开走
余生分开走 2020-12-02 07:50

I\'m using the font library font awesome. It works when the project is not built/uglified with grunt.

But when I\'m building the project with grunt it\'s not workin

15条回答
  •  孤街浪徒
    2020-12-02 08:15

    I don't know what I was doing wrong but none of the proposed solutions worked for me. Whatever I tried, the production (distribution) release would not display the icons.

    I ended up using the following components: https://github.com/philya/font-awesome-polymer-icons-generator and https://github.com/philya/font-awesome-polymer-icons

    font-awesome-polymer-icons-generator

    Note: python needed

    It allows you to generate a font-awesome SVG icon set for the icons (you have in use) in your project.

    As an example, say I want the icons code, line-chart, github-alt in my projects, then I'd generate them like so:

    ./makefaicons.py myappname code line-chart github-alt
    

    This generates the file build/myappname-icons.html. This file then needs to be imported into my component just like any other component:

    
    

    then I can get the font-awesome icons like so:

    
    

    i.e. I prefix the normal font-awesome name with the name I gave when I created the icon set.

    font-awesome-polymer-icons

    You can also just import the pre-built full set of font-awesome icons:

    bower install font-awesome-polymer-icons
    

    Keep in mind that this adds 300+KB to your distribution size and the author notes that it is not recommended for production use.

提交回复
热议问题