Does Stylus support arrays of variables?

我的未来我决定 提交于 2019-12-05 12:06:41

using a list works for me:

cards_colors = ( #E0137E #8431BF #2388C4 )

for num in (0..2)
  .card-{num}
    background cards_colors[num]

see demo: http://codepen.io/anon/pen/IeiEw

Stylus does support arrays, but it's hard to find in their documentation, even after they revamped it

$arrayName = value0, value1, value2
$arrayName[1] //value1

With using range()

cards_colors = ( #E0137E #8431BF #2388C4 )

for num in range(0,(length(cards_colors) - 1))
  .card-{num}
    background cards_colors[num]
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!