css - SASS 错误 : Properties are only allowed within rules, 指令、mixin 包含或其他属性

标签 css error-handling sass

错误: @import "./styles/mixins"; ^ 属性只能在规则、指令、mixin 包含或其他属性中使用。

我的 scss 文件就是这么简单:

@import "./styles/mixins";

// There shouldn't be anything else
// Set my variables


@import "styles/variables";

@import "styles/core-style";

@include font-importer("Raleway Regular",'normal',400,"./assets/fonts/Raleway/Raleway-Regular.ttf");
@include font-importer("Raleway Bold",'normal',700,"./assets/fonts/Raleway/Raleway-Bold.ttf");
@include font-importer("Raleway Light",'normal',300,"./assets/fonts/Raleway/Raleway-Light.ttf");
@include font-importer("Raleway Medium",'normal',500,"./assets/fonts/Raleway/Raleway-Medium.ttf");

这是什么意思?我不明白 Sass 错误。我不明白在哪里看。我必须做什么?

谢谢,

史蒂芬。

最佳答案

您的font-importer 返回什么?

错误解释:

Properties are only allowed within rules, directives, mixin includes, or other properties.

这意味着你在 css 选择器之外调用你 mixin。
例如,此代码将产生相同的错误:

@mixin color() {
  color: red;
}

@include color(); // call mixin without css selector

关于css - SASS 错误 : Properties are only allowed within rules, 指令、mixin 包含或其他属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48558206/

相关文章:

html - ="search"类型的输入没有显示圆 Angular

c - 是否有 CUDA 等同于 perror()?

c - 错误: assignment to expression with array type while using selection-sort

css - 为什么,如果 CSS 属性在之后声明,会被之前的一些声明覆盖

Sass变量插值,输出中带有反斜杠

css - 文本和标签以 CSS 圆为中心

css - Div css 过渡不会在切换时折叠

html - 如何在菜单中适合图像

delphi - 正确的灾难性错误处理

javascript - 将 node-sass-json-importer 集成到 Angular CLI 应用程序中