[Maven 編譯] fontawesome 問題: Failed to decode downloaded font

使用maven 編譯WEB項目時,按鈕上的圖標不顯示(使用http://fontawesome.io/icons/)css

在瀏覽器console中打印錯誤:OTS parsing error: incorrect entrySelector for table directory 1 Failed to decode downloaded font: https://my-address.com/css/fonts/robot...web

 

緣由:使用maven-resources-plugin copy 靜態資源時,若是有<filtering>true</filtering>標籤,會破壞fontawesome 中的文件瀏覽器

  

<resources>
    <resource>
        <directory>${project.basedir}/src/main/webapp</directory>
	<targetPath>${project.build.directory}</targetPath>
	<filtering>true</filtering>
</resources>    

 

 

解決辦法: tomcat

(1) 將 <filtering>true</filtering> 改成falseapp

 (2) webapp

<resources>
  <resource>
    <directory>${project.basedir}/src/main/webapp</directory>
    <targetPath>${project.build.directory}</targetPath>
    <filtering>true</filtering>
    <excludes>
      <exclude>**/*.woff</exclude>
      <exclude>**/*.ttf</exclude>
      <exclude>**/*.woff2</exclude>
      <exclude>**/*.otf</exclude>
      <exclude>**/*.eot</exclude>
      <exclude>**/*.svg</exclude>
    </excludes>
  </resource>
  <resource>
    <directory>${project.basedir}/src/main/webapp</directory>
    <targetPath>${project.build.directory}</targetPath>
    <filtering>false</filtering>
    <includes>
      <include>**/*.woff</include>
      <include>**/*.ttf</include>
      <include>**/*.woff2</include>
      <include>**/*.otf</include>
      <include>**/*.eot</include>
      <include>**/*.svg</include>
    </includes>
  </resource>
</resources>

 

參考:http://stackoverflow.com/questions/32690418/i-cant-load-fonts-while-using-tomcatelectron

         http://stackoverflow.com/questions/32475982/fontawesome-fails-to-load-fonts-locally-and-in-electron-appmaven

相關文章
相關標籤/搜索