Fontawesome is not working when project is built with grunt

前端 未结 15 1185
余生分开走
余生分开走 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 07:58

    If you are using the complete grunt task stack from yeoman then the useminPrepare task builds a combined stylesheet from all stylesheets that you put in the build:css comment - as you do. (see https://github.com/yeoman/grunt-usemin for additional informations) After the build process is done this file - somewhat like "vendor.234243.css" is copied to the styles folder. That's why the path for your font is no longer valid. There are at least 2 possibilities to solve this:

    1. You could remove the font-awesom css out of the build:css block:

      
      
       this will be processed by useminPrepare 
      
      
    2. Copy the fonts folder as a sibling to the styles folder by an aditional grunt task in your gruntfile.

提交回复
热议问题