Вопрос

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