【发布时间】:2017-02-05 08:43:15
【问题描述】:
我正在使用一个名为 typi (https://github.com/zellwk/typi) 的 sass mixin 库,现在如何在 sass 映射函数中使用 !important 关键字,这是我尝试实现的示例
$i:!important;
$heading:(
null:( 80px,80px $i),
large:(60px,60px $i),
small:(40px,40px $i)
);
我正在尝试在键值中使用 !important 关键字,例如 空:(80px $i,80px $i)
每当我使用关键字时,我都会在编译时收到此错误
" error sass/style.scss (第 30 行 sass/typi/scss/ty/_functions.scss: $number: "80px!important" is not a number for `unitless') "
【问题讨论】:
-
如果你使用适当的特异性,你不应该需要一个 !important
-
我同意,尽管在某些情况下您也必须使用 !important :)
-
您不能将
!important传递给函数。因为它只需要一个数字,而不是 css 属性值。