下载element-ui 资源,图标 element-icons.woff,element-icons.ttf 无法解码文件字体

css下载地址: https://unpkg.com/[email protected]/lib/theme-chalk/index.css

js下载地址: https://unpkg.com/[email protected]/lib/index.js

图标及文字文件下载地址:

element-icons.woff::

​ https://unpkg.com/[email protected]/lib/theme-chalk/fonts/element-icons.woff ​

element-icons.ttf:

https://unpkg.com/[email protected]/lib/theme-chalk/fonts/element-icons.ttf

访问项目发现icon图标无法现在!

浏览器控制台报错:

Failed to decode downloaded font: http://localhost:8080/demo/css/ui/element/fonts/element-icons.woff

报错原因:Maven构建过程中,默认会对资源文件过滤处理,有些文件内容或字体被Maven处理之后不能正常解析。

解决方式:

在pom.xml文件中添加 maven-resources-plugin 插件

复制代码
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.6</version>
    <configuration>
        <nonFilteredFileExtensions>
            <nonFilteredFileExtension>ico</nonFilteredFileExtension>
            <nonFilteredFileExtension>otf</nonFilteredFileExtension>
            <nonFilteredFileExtension>woff</nonFilteredFileExtension>
            <nonFilteredFileExtension>woff2</nonFilteredFileExtension>
            <nonFilteredFileExtension>eot</nonFilteredFileExtension>
            <nonFilteredFileExtension>svg</nonFilteredFileExtension>
            <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
        </nonFilteredFileExtensions>
        <encoding>UTF-8</encoding>
    </configuration>
</plugin>

然后重新构建项目!

相关推荐
不知几秋10 小时前
Maven
java·数据库·maven
下雨天u13 小时前
maven dependencyManagement标签作用
java·数据库·maven
码农飞哥14 小时前
互联网大厂Java求职面试实战:Spring Boot到微服务全景解析
java·spring boot·微服务·maven·hibernate·技术栈·面试技巧
极乐谷215 小时前
Maven 项目构建时编译错误问题排查与解决
java·maven
forestsea1 天前
Maven 插件参数注入与Mojo开发详解
java·maven·mojo
Jelian_1 天前
element-ui的el-cascader增加全选按钮实现(附源码)
vue.js·ui·elementui
开开心心就好2 天前
高效全能PDF工具,支持OCR识别
java·前端·python·pdf·ocr·maven·jetty
松树戈2 天前
openfeign与dubbo调用下载excel实践
vue.js·spring cloud·elementui·dubbo
跑调却靠谱2 天前
elementUI调整滚动条高度后与固定列冲突问题解决
前端·vue.js·elementui
shane-u3 天前
Maven私服搭建与登录全攻略
java·maven