手写笔查找哈希名称

Stylus Lookup for hash name

有没有办法使用 Stylus lookup 函数在 for-in 循环中应用哈希?

$badge-photo-S   = {
  size: 36px
  font-size: 16px
} 
$badge-photo-XS  = {
  size: 32px
  font-size: 13px
}
.s-badge
  &-photo
    for each in S XS
      &--{each}
        {lookup('$badge-photo-'+each)}

它应该屈服于:

.s-badge-photo--S {
  width: 36px
  height: 36px;
  font-size: 16px;
} 

.s-badge-photo--XS {
  width: 32px
  height: 32px;
  font-size: 13px;
} 

但它提供了一个空输出。

你需要将lookup的结果保存到一个变量中,然后在{}中使用它:

$badge-photo-S   = {
  size: 36px
  font-size: 16px
} 
$badge-photo-XS  = {
  size: 32px
  font-size: 13px
}
.s-badge
  &-photo
    for each in S XS
      &--{each}
        hash = lookup('$badge-photo-'+each)
        {hash}