为什么我们使用#{}进行插值?我们不能只使用scss变量吗?

时间:2019-03-13 18:57:20

标签: sass scss-mixins

我在下面看到了#{}的使用:

$information-phone: "only screen and (max-width : 320px)";

@media #{$information-phone} {
    background: red;
}

使用#{}的目的是什么?我不能简单地执行以下操作:

$information-phone: "only screen and (max-width : 320px)";

@media $information-phone {
    background: red;
}

从本质上讲,无论在哪里使用插值(#{}),我都不能使用sass变量吗?

1 个答案:

答案 0 :(得分:0)

我认为,因为Sass由Ruby处理,而在Ruby中,变量值的“打印”由插值#{myVar}进行管理

Ruby Interpolation

相关问题