Spring Boot + Bootstrap 出现"Failed to decode downloaded font"和"OTS parsing error: Failed to convert W

转载自:https://www.cnblogs.com/tomcatandjerry/p/5799188.html


准确来讲,应该是maven项目使用Bootstrap时,出现

"Failed to decode downloaded font"和"OTS parsing error: Failed to convert WOFF 2.0 font to SFNT"

导致图标出不来的问题。

 

解决方案:

设置filter,font文件不需要filter,见下面示例:

 1 <build>
 2         <finalName>bootstrap in mavenfinalName>
 3         <resources>
 4             <resource>
 5                 <directory>src/main/resourcesdirectory>
 6                 <filtering>truefiltering>
 7                 <excludes>  
 8                     <exclude>static/fonts/**exclude>  
 9                 excludes>  
10             resource>
11             
12             <resource>  
13                 <directory>src/main/resourcesdirectory>  
14                 <filtering>falsefiltering>  
15                 <includes>  
16                     <include>static/fonts/**include>  
17                 includes>  
18             resource>  
19             <resource>
20                 <directory>src/main/javadirectory>
21                 <includes>
22                     <include>**/*.xmlinclude>
23                 includes>
24             resource>
25         resources>
26 ...
27 build>
复制代码

原因:

上面的xml里也写了,因为经过maven的filter,会破坏font文件的二进制文件格式,到时前台解析出错。

你可能感兴趣的:(Spring Boot + Bootstrap 出现"Failed to decode downloaded font"和"OTS parsing error: Failed to convert W)