處理springboot OTS parsing error: Failed to convert WOFF 2.0 font to SFNT

springboot項目中添加了字體等文件後,頁面沒法識別,瀏覽器調試窗口報錯以下:javascript

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

Failed to decode downloaded font: http://localhost:8080/fonts/fontawesome-webfont.ttf?v=4.4.0
OTS parsing error: incorrect entrySelector for table directory

 解決方式,pom文件中增長以下內容,不對字體文件進行過濾便可:java

<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>

 

最後不要忘記重啓項目!!清空瀏覽器緩存!!web

相關文章
相關標籤/搜索