我想从Card.scss
导入变量,但保留错误:
Undefined variable: "$card-width".
如何正确导入变量?
Card.scss
@mixin small-card {
$card-width: 100px;
$card-height: 200px;
}
@mixin big-card {
$card-width: 300px;
$card-height: 600px;
}
TypeACard.css
@import '../../Card.scss';
@include small-card;
.card {
width: $card-width;
height: $card-height;
}
TypeBCard.css
@import '../../Card.scss';
@include big-card;
答案 0 :(得分:0)
更改为@import '../../Card.scss';
如果它仍然不起作用,那么该目录很可能是错误的,祝你好运。
答案 1 :(得分:0)
将您的变量文件放在导入所有其他sass文件的顶部。感谢。