【发布时间】:2018-12-30 02:06:06
【问题描述】:
我正在尝试将几种本地字体添加到新网站。字体似乎下载正确,字体定义如下:
@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 配置here。
这是一个公共仓库,在本地运行项目时可以重现该问题:
克隆:
git clone -b feature/font-faces https://github.com/webmadeira/webmadeira.github.io.git安装依赖:
npm install- 运行项目:
npm start
【问题讨论】:
标签: javascript webpack styled-components