【发布时间】:2018-11-12 19:37:31
【问题描述】:
尝试在我的 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):
未定义 ^
darken($color, $amount)的参数$color必须是颜色
这是 _variables.scss 中有问题的行:
$link-hover-color: darken($link-color, 15%) !default;
声明它上面的两行:
$link-color: theme-color("primary") !default;
我在这里查看了许多可能的解决方案,但其中大多数都说将函数放在已经完成但错误仍然存在的 vars 之前。
非常感谢任何帮助。
【问题讨论】:
-
$color的值是多少? -
这是 _variables.scss 中有问题的行:
$link-hover-color: darken($link-color, 15%) !default;上面声明的两行:$link-color: theme-color("primary") !default; -
您应该将该文件的相关部分放入您的答案中
-
将这些部分添加到我的问题中。
-
在您使用变量
$link-color的代码上,而错误消息引用$color- 您使用的是正确的变量吗?
标签: bootstrap-4 angular6