【发布时间】:2025-11-30 06:10:01
【问题描述】:
我需要将本地字体加载到我的ng-seed/universal 中, 我只是这里的新手,我需要一些建议才能让它发挥作用。
我试图在我的webpack.config.js 上添加波纹管配置,但它似乎不起作用:)
module: {
rules: [
{
test: /\.(ttf|eot|woff|woff2)$/,
loader: 'file-loader',
options: {
name: 'fonts/[name].[ext]',
},
}
]
}
这是我在sass 文件中调用我的自定义字体的字体
@font-face {
font-family: 'CustomFont';
src: url('./assets/fonts/CustomFont.eot');
src: url('./assets/fonts/CustomFont.eot?#iefix') format('embedded-opentype'),
url('./assets/fonts/CustomFont.woff') format('woff'),
url('./assets/fonts/CustomFont.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
当我在开发模式下点击npm run 时,出现错误Error: Path variable [chunkhash] not implemented in this context: assets/CustomFont.[chunkhash].eot。
谢谢。
【问题讨论】:
-
您是否要为整个应用程序全局导入?
-
是的,我确实想要全局导入字体:)