![](/img/trans.png)
[英]Google fonts imports not working on Angular Material production build
[英]Angular project production build has problem importing google fonts
我有一个基于最新版本 8.2.9 构建的 angular 项目。 Google fonts 在使用ng serve
的测试环境中完美运行。 但是,当我在生产服务器上发布项目时,未加载 fonts。
样式.scss
@import url('https://fonts.googleapis.com/css?family=Nunito:200,600');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons');
但是,当我将上述 fonts 加载语句从全局样式style.scss
到app.component.scss
。 它工作正常吗? 为什么它不适用于全球风格? 我在这里发现了与这个问题类似的东西ng build/serve --prod ignores scss url imports
只需在<head>
标记中包含 google fonts 到 index.html 中,而不是任何 scss 或 css 文件。
它也适用于生产构建。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.