我收到 sass 错误:声明只能在样式规则中使用。
\n \xe2\x95\xb7\n32 \xe2\x94\x82 #{$property}: $value;\n \xe2\x94\x82 ^^^^^^^^^^^^^^^^^^^^\nRun Code Online (Sandbox Code Playgroud)\n对于以下文件:
\n@mixin theme($colour, $texture: null) {\n $theme: map-get-strict($themes, $colour, "theme");\n\n @if ($texture) {\n @include getTexture($texture);\n }\n\n @each $property, $value in $theme {\n #{$property}: $value;\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n这是使用 dart-sass。
\n我认为这可能是导致问题的 Sass 测试文件,例如:
\n@include it('outputs the light-blue theme') {\n @include assert {\n @include output {\n @include theme(light-blue);\n }\n\n @include expect {\n background-color: getColour(light-blue);\n color: getColour(black);\n }\n }\n }\nRun Code Online (Sandbox Code Playgroud)\n
小智 15
声明只能在样式规则内使用。
您只能在样式规则中使用声明。这意味着如果你有一个包含声明的 mixin
例如:
@mixin foo() {
color: #000;
}
Run Code Online (Sandbox Code Playgroud)
您只能将其包含在样式规则中。
例如:
.bar {
@include foo();
}
Run Code Online (Sandbox Code Playgroud)
这有助于确保编译后的 CSS 没有错误。
颜色:#000;
.bar {
color: #000;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8489 次 |
| 最近记录: |