zoukankan      html  css  js  c++  java
  • [Maven 编译] fontawesome 问题: Failed to decode downloaded font

    使用maven 编译WEB项目时,按钮上的图标不显示(使用http://fontawesome.io/icons/)

    在浏览器console中打印错误:OTS parsing error: incorrect entrySelector for table directory 1 Failed to decode downloaded font: https://my-address.com/css/fonts/robot...

    原因:使用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>    
    

    解决办法:

    (1) 将 <filtering>true</filtering> 改为false

     (2)

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

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

  • 相关阅读:
    [Ansible]copy 模块
    [Ansible]script模块
    [Ansible]command shell模块
    [Ansible]Systemd 模块
    [Ansible]YUM 模块
    [Ansible]yum_repository模块 添加 删除yum源
    [Ceph]osd 无法启动 start request repeated too quickly for ceph-osd@1.service
    [Ceph]pool 删除 Error EPERM: pool deletion is disabled; you must first set the mon_allow_pool_delete config option to true before you can destroy a pool
    题解 烷基计数 加强版 加强版
    Polya 定理 学习笔记
  • 原文地址:https://www.cnblogs.com/zexu-cheng/p/6774024.html
Copyright © 2011-2022 走看看