Following code

for $i in (1..81)
   .block:nth-child({$i})
      transition transform 500ms ease $i\s

will be compiled to

.block:nth-child(1) {
    transition: transform 500ms ease 1 s;
}

......

But that space between number and seconds is redundant!

How can I remove it?

有帮助吗?

解决方案

One possible approach:

for $i in (1..81)
   .block:nth-child({$i})
     transition transform 500ms ease 1s * $i

That's actually quite similar to the example given in Selector Interpolation section of Stylus documentation.

其他提示

You can use the unit() function:

for $i in (1..81)
  .block:nth-child({$i})
    transition transform 500ms ease unit($i, 's')
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top