jeudi 29 janvier 2015

Stylus - creating functions in a loop?


Vote count:

0




My question is pretty simple. In my .styl I have:



locked-widths(nums)
for i in 1..nums
.w-{i}
$percent = i
width: $percent+"%"


Where nums is a integer normally set to 100 (which gives me classes like .w-1, .w-2, .w-3 and so on).


But what I would like to do is first assigning the CSS width property to a stylus function with the same name as the class, then using that function on the class like so:



locked-widths(nums)
for i in 1..nums
w-{i}()
$percent = i
width: $percent+"%"
.w-{i}
w-{i}()


..which doesn't work. Do you have any idea if this is possible? Thanks.



asked 2 mins ago







Stylus - creating functions in a loop?

Aucun commentaire:

Enregistrer un commentaire