与sass抗争每个输出都是空的

与sass抗争每个输出都是空的,sass,Sass,我将尝试类似的方法: 我有这个scss代码: $max-width: 95vw; $max-height: 95vh; $styleFactors: ("very-large": 1, "large": 0.75, "normal": 0.4, "small": 0.35); @each $widthOrHeight in "width", "height"{ @each $style, $factor in $styleFactors { $max-size: if($wi

我将尝试类似的方法:

我有这个scss代码:

$max-width: 95vw;
$max-height: 95vh;

$styleFactors: ("very-large": 1, "large": 0.75, "normal": 0.4, "small": 0.35);

@each $widthOrHeight in "width", "height"{

  @each $style, $factor in $styleFactors {

    $max-size: if($widthOrHeight == "width", $max-width, $max-height);
    .#{$widthOrHeight}-#{$style} {
      $style: calc(#{$max-size} * #{$factor});
    }
  }
}
预期输出应如下所示:

.width-very-large{
  width: calc(95vw * 1);
}
.width-large{
  width: calc(95vw * 0.75);
}
.width-normal{
  width: calc(95vw * 0.4);
}
.width-small{
  width: calc(95vw * 0.35);
}
//...
//and same with height
但是根本没有输出,我不知道为什么会发生这种情况

没有错误或任何东西


您实际上没有应用任何样式,空样式将被删除。例如,如果您添加
#{$widthOrHeight}:$style
$style:calc(#{$max size}*#{$factor})之后您将看到一个输出。

更新:

故障发生在17号线:

$max-width: 95vw;
$max-height: 95vh;

$styleFactors: ("very-large": 1, "large": 0.75, "normal": 0.4, "small": 0.35);

@each $widthOrHeight in "width", "height"{

  @each $style, $factor in $styleFactors {

    $max-size: if($widthOrHeight == "width", $max-width, $max-height);
    .#{$widthOrHeight}-#{$style} {
    #{$widthOrHeight}: calc(#{$max-size} * #{$factor});
    }
  }
}