spring boot 解決加載字體文件報錯

springboot項目中添加了字體等文件後,頁面圖標無法識別,模板使用的element ui 的圖標庫 。需要使用到woff 瀏覽器調試窗口報錯如下:

Failed to decode downloaded font:
http://localhost:8082/fonts/fontawesome-webfont.woff?v=4.4.0 OTS
parsing error: incorrect file size in WOFF header Failed to decode
downloaded font:
http://localhost:8082/fonts/fontawesome-webfont.ttf?v=4.4.0 OTS
parsing error: incorrect entrySelector for table directory

解決方式添加maven插件,進行過濾   

<build>
  <plugins> 
    <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-resources-plugin</artifactId>
     <configuration>
          <nonFilteredFileExtensions>
               <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
               <nonFilteredFileExtension>woff</nonFilteredFileExtension>
               <nonFilteredFileExtension>woff2</nonFilteredFileExtension>
          </nonFilteredFileExtensions>
     </configuration>
    </plugin>
  </plugins>
</build>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章