springboot项目中ttf和woff字体图标页面无法显示
浏览器控制台报错如下:
Failed to decode downloaded font: http://127.0.0.1:8081/fonts/element-icons.woff index:1 OTS parsing error: incorrect file size in WOFF header index:1 Failed to decode downloaded font: http://127.0.0.1:8081/fonts/element-icons.ttf index:1 OTS parsing error: incorrect entrySelector for table directory
解决办法
在网上找到了不下于4种解决方法,只有下面一种可行。 在pom.xml的build节点下添加
<resources> <resource> <directory>${project.basedir}/src/main/resources</directory> <filtering>true</filtering> <excludes> <exclude>static/js/element-ui/fonts/**</exclude> </excludes> </resource> <resource> <directory>${project.basedir}/src/main/resources</directory> <filtering>false</filtering> <includes> <include>static/js/element-ui/fonts/**</include> </includes> </resource> </resources>
注意:directory
是 ${project.basedir}/src/main/resources
百度其他的几种方式皆无效,给我干自闭了
记忆力下降,日常日志