sass :SassError: Invalid CSS after "$--colors: map": expected expression(e.g. 1px, bold)

bizhixiang 注册会员
2023-02-25 21:18

Part of this answer references GPT, GPT_Pro for better resolution
SassError: Invalid CSSs after "$--colors: map": expected expression(e.g. 1px, bold) This error indicates that css after "$--colors: map" is not valid and that the expression expected should be 1px or bold.

Therefore, this error is mainly caused by syntax errors in the Sass code. You should carefully check whether the variable declarations, function arguments and attribute values in the Sass code are correct, or if some attribute values are missing.

To solve this problem, we first need to locate which line of Sass code has the error, for example, the following line in the code:

$--colors: map(#000, #fff, #ccc);

There is a syntax error, map should be replaced with list, and the resulting code looks like this:

$--colors: list(#000, #fff, #ccc);

The code above resolves SassError: Invalid CSSs after "$--colors: By declaring the $--colors variable and passing the values of #000, #fff, and #ccc as a list into the $--colors variable. map": expected expression(e.g. 1px, bold) This is an error.
If the answer is helpful, please accept it.