bootstrap-4 - `darken($color, $amount)` 的参数 `$color` 必须是颜色 Bootstrap 4 Angular 6
问题描述
尝试在我的 Angular 6 应用程序中使用 Bootstrap 4 a la carte,就像在我的 angular.json 文件中一样...
"styles": [
"node_modules/bootstrap/scss/_functions.scss",
"node_modules/bootstrap/scss/_variables.scss",
"node_modules/bootstrap/scss/_mixins.scss",
"src/styles.scss"
]
在进行 sass 加载尝试后会在终端中产生此错误...
./node_modules/bootstrap/scss/_variables.scss 中的错误(./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./node_modules/sass-loader/lib/loader.js?? ref--15-3!./node_modules/bootstrap/scss/_variables.scss) 模块构建失败(来自 ./node_modules/sass-loader/lib/loader.js):
undefined ^
$color
的参数darken($color, $amount)
必须是颜色
这是 _variables.scss 中有问题的行:
$link-hover-color: darken($link-color, 15%) !default;
声明它上面的两行:
$link-color: theme-color("primary") !default;
我在这里查看了许多可能的解决方案,但其中大多数都说将函数放在已经完成的 vars 之前,但错误仍然存在。
非常感谢任何帮助。
解决方案
我遇到了这个问题。所需要的只是在我的其他导入之前导入函数:
@import '../../node_modules/bootstrap/scss/functions';
// ... remaining bootstrap imports...
推荐阅读
- visual-studio - 安装 expo cli windows 时出错
- open-policy-agent - 如何使用 Open Policy Agent Gatekeeper K8sPSPCapabilities 约束模板将容器列入白名单
- java - 如何构建一个新列表,其中包含现有列表中的所有条目以及修改了一个字段的每个条目的副本?
- jquery - 使用 Gsap 中的 Draw SVG 将 svg 动画从 0% 到 100%
- swift - SwiftUI:扩展数组以获取数组实例的绑定
- react-native - 文本左对齐未以 android 为中心
- django - 如何更改用户的电子邮件并使用 usercreationform 确认它 - django
- asp.net-core - Asp.net core 3.0 - 结合身份认证和挑战方案
- python-3.x - 转换日期时间后,我的时间戳中未显示小时、分钟和秒
- amazon-sqs - 尝试在 SQS 中保存时请求返回 AccessDenied