-1

我无法让 mixin 接受一个块:

=my-mixin($some-var)
  width: $some-var
  @content // Is this correct?

+my-mixin(123px)
  height: 100px

这会导致“mixin 不接受内容块”错误。我正在使用当前版本的 Sass。感谢帮助。

4

3 回答 3

3

SASS 3.2 版的语法没问题,请仔细检查

于 2013-10-18T22:13:53.880 回答
0

对我来说,问题在于 SASS 缩进。

您不能像这样在 mixin 中嵌套另一个块:

.button-cta
  +button (transparent, tomato)
    &:hover
      background-color: tomato
      color: #fff

反而:

  .button-cta
    +button (transparent, tomato)
    &:hover
      background-color: tomato
      color: #fff

悬停状态不能嵌套

于 2017-01-10T13:46:16.377 回答
0

我也收到了这个错误。原来,我在我的 scss 中的其他地方使用@mixin mobile-only而不是@include mobile-only- 也就是,我后来在代码中不小心重新定义了 mixin。

于 2019-03-04T16:02:32.717 回答