Bootstrap 5 + SASS 错误:未定义 MIXIN @include _assert-ascending

问题描述

我正在按照 freecodecamp 教程学习 SCSS,但我在实时 sass 的 CLI 上不断收到以下错误:watch:

Error: Undefined mixin.
    ╷
320 │ @include _assert-ascending($grid-breakpoints,"$grid-breakpoints");
    │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ╵
  node_modules\bootstrap\scss\_variables.scss 320:1  @use
  node_modules\bootstrap\scss\bootstrap.scss 11:1    @import
  scss\_custom.scss 58:8                             @use
  scss\style.scss 1:1  

任何对 SASS 更有经验的人能否指出我正确的方向,我不知道从这里开始该怎么做。我是否需要将我们的 @use 导入添加到 custom.scss 中?

解决方法

我刚刚遇到了这个问题。您还需要包含functions.css。

https://github.com/twbs/bootstrap/issues/23451

,

我遇到了这个问题。我的问题是我以错误的顺序导入:

@import '../node_modules/bootstrap/scss/mixins';
@import '../node_modules/bootstrap/scss/functions';
@import '../node_modules/bootstrap/scss/variables';

我把它改成了

@import '../node_modules/bootstrap/scss/functions';
@import '../node_modules/bootstrap/scss/variables';
@import '../node_modules/bootstrap/scss/mixins';

您需要按此特定顺序导入这三个文件。您可能遗漏了其中一个导入,或者也可能以错误的顺序编写。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...