是否可以在sass / scss中将另一个值附加到现有变量中?

时间:2016-01-12 11:12:17

标签: css sass

我在我正在使用的框架的外部文件中定义了这个:

$font-family-sans-serif: "Helvetica Neue", "Roboto", "Segoe UI", sans-serif !default;

我想预备自己的字体(在不同的文件中,例如,不改变FW变量文件)。

$font-family-sans-serif: 'MyFont', $font-family-sans-serif;

那么,有可能吗?以上不起作用。

Error: Undefined variable: "$font-family-sans-serif".
        on line 3 of scss/variables.scss
        on line 3 of scss/variables.scss
>> $font-family-sans-serif: 'MyFont', $font-family-sans-serif;

1 个答案:

答案 0 :(得分:0)

It's valid SASS as long as these files are compiled together. Are you sure that external file with the variable $font-family-sans-serif has been included before you modify the variable?

Here's your example, but concatenated. It works fine:

$font-family-sans-serif: "Helvetica Neue", "Roboto", "Segoe UI", sans-serif !default;
$font-family-sans-serif: 'MyFont', $font-family-sans-serif;