从服务器下载的字体文件放在本地,执行无法展示iconfont,浏览器控制台报出

Failed to decode downloaded font: http://127.0.0.1:8080/mhr/group-assets/iconfont/iconfont.ttf?t=1500884389272
login_group.html:1 OTS parsing error: invalid version tag 错误。

原因是ttf文件和woff文件被项目所拦截,尽管在静态文件中展示正常。

1. spring安全过滤

spring-security.xml
<sec:http pattern="/**/*.woff" security="none" />
<sec:http pattern="/**/*.tff" security="none" />

2. maven安全过滤

 在pom.xml中添加:

<filter>true<filter>变为false;

<build>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>false</filtering>
            <excludes>
                <exclude>public/bower_components/**</exclude>
                <exclude>public/coverage/**</exclude>
                <exclude>public/node_modules/**</exclude>
            </excludes>
            <includes>
                <include>**</include>
            </includes>
        </resource>
    </resources>
</build>

 

posted on 2017-07-25 10:46  zhaoqiang1980  阅读(8168)  评论(0编辑  收藏  举报