Is it possible to implement something like this in Stylus?

for $i in 1..5 and $n in a b c d e
  .icon-{$i}:before{
    content: $n 
  }
有帮助吗?

解决方案

To answer your question: yes.


and here is how: http://codepen.io/anon/pen/jIbdq

icon_contents = ( "a" "b" "c" "d" "e" )

for v, k in icon_contents
  .icon-{k+1}:before
    content v
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top