我无法让 mixin 接受一个块:
=my-mixin($some-var)
  width: $some-var
  @content // Is this correct?
+my-mixin(123px)
  height: 100px
这会导致“mixin 不接受内容块”错误。我正在使用当前版本的 Sass。感谢帮助。
SASS 3.2 版的语法没问题,请仔细检查
对我来说,问题在于 SASS 缩进。
您不能像这样在 mixin 中嵌套另一个块:
.button-cta
  +button (transparent, tomato)
    &:hover
      background-color: tomato
      color: #fff
反而:
  .button-cta
    +button (transparent, tomato)
    &:hover
      background-color: tomato
      color: #fff
悬停状态不能嵌套
我也收到了这个错误。原来,我在我的 scss 中的其他地方使用@mixin mobile-only而不是@include mobile-only- 也就是,我后来在代码中不小心重新定义了 mixin。