【发布时间】:2020-04-09 13:43:20
【问题描述】:
font-awesome 不在 prod build 中加载,而是在 localhost 中加载。
我正在使用下面的代码
_Variable.scss:
$fa-font-path: "../webfonts" !default;
solid.scss:
@import "variables";
@font-face {
font-family: "Font Awesome 5 Pro";
font-style: normal;
font-weight: 900;
font-display: $fa-font-display;
src: url("#{$fa-font-path}/fa-solid-900.eot");
src: url("#{$fa-font-path}/fa-solid-900.eot?#iefix")
format("embedded-opentype"),
url("#{$fa-font-path}/fa-solid-900.woff2") format("woff2"),
url("#{$fa-font-path}/fa-solid-900.woff") format("woff"),
url("#{$fa-font-path}/fa-solid-900.ttf") format("truetype"),
url("#{$fa-font-path}/fa-solid-900.svg#fontawesome") format("svg");
}
我构建了我的 Angular 项目并运行了 index.html。 字体真棒图标没有加载。它在 C:/ drive 文件夹而不是我的项目构建文件夹中查找?
angular.json 文件:
"architect": {
"build": {
"builder": "ngx-build-plus:build",
"options": {
"outputPath": "dist/registrationApp",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/webfonts",
"src/assets",
"src/config.json",
"src/config.local.json"
],
"styles": [
"src/styles.scss",
"node_modules/bootstrap/dist/css/bootstrap.min.css"
],
"stylePreprocessorOptions": {
"includePaths": ["./src/styles", "./node_modules/bootstrap/scss"]
},
请提出问题所在?
【问题讨论】:
标签: html css angular font-awesome scss-mixins