javascript - font-face 样式组件 - OTS 解析错误:无效的版本标签
问题描述
我正在尝试将几种本地字体添加到新网站。字体似乎下载正确,字体定义如下:
@font-face {
font-family: 'Roboto Mono';
font-style: normal;
font-weight: 400;
src: url('/fonts/roboto-mono-v5-latin-regular.eot'); /* IE9 Compat Modes */
src: local('Roboto Mono'), local('RobotoMono-Regular'),
url('/fonts/roboto-mono-v5-latin-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/roboto-mono-v5-latin-regular.woff2') format('woff2'), /* Super Modern Browsers */
url('/fonts/roboto-mono-v5-latin-regular.woff') format('woff'), /* Modern Browsers */
url('/fonts/roboto-mono-v5-latin-regular.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/roboto-mono-v5-latin-regular.svg#RobotoMono') format('svg'); /* Legacy iOS */
}
但我仍然收到以下错误:
你可以在这里查看我的 webpack 配置。
这是一个公共仓库,在本地运行项目时可以重现该问题:
克隆:
git clone -b feature/font-faces https://github.com/webmadeira/webmadeira.github.io.git
安装依赖项:
npm install
- 运行项目:
npm start
解决方案
解决方案是更改我的 webpack 配置:
{
test: /.(png|jpg|jp(e)?g|svg)(\?[a-z0-9]+)?$/,
use: {
loader: 'file-loader',
options: {
publicPath: 'images',
name: '/[name].[ext]',
},
},
},
至:
{
test: /.(png|jpg|jp(e)?g|svg)(\?[a-z0-9]+)?$/,
use: {
loader: 'file-loader',
options: {
name: 'images/[name].[ext]',
},
},
},
推荐阅读
- javascript - 当它们进入视口时延迟加载地图
- realm - 在域 Keycloak 服务器上创建领域/客户端不会立即对从属 Keycloak 节点可见
- google-sheets - 将多列组合成一个范围
- java - 关于这段 Java 代码的问题,为什么要这样写
- azure - 如何使用 Azure 数据工厂执行带有日期或键列的增量加载
- database - 具有多个关系和继承的实体的灵活数据库结构
- azure-devops - 删除任务 VSTS
- tensorflow - 训练对象检测分类器 如何使用 TensorFlow 赚钱
- laravel - 手动设置 url.intended 和错误的浏览器历史记录
- java - 从范围返回模式字符串的java方法