Open pgherveou opened 12 years ago
+1
thats how my -pos
looks like :D
-pos(type, args)
i = 0
position: unquote(type)
{args[i]}: args[i + 1] is a 'unit' ? args[i += 1] : 0
{args[i += 1]}: args[i + 1] is a 'unit' ? args[i += 1] : 0
{args[i += 1]}: args[i + 1] is a 'unit' ? args[i += 1] : 0
{args[i += 1]}: args[i + 1] is a 'unit' ? args[i += 1] : 0
I am new to stylus, so not sure about that but doesn't your solution add a null: 0 to the css if you don't specify the fourth argument ?
you are right, my -pos
is really just a quick hack without thinking about it - its only ok for me because i am defining all 4 positions everytime.
still +1 for this :D
maybe like that?
-pos(type, args)
i = 0
position: unquote(type)
{args[i]}: args[i + 1] is a 'unit' ? args[i += 1] : 0
{args[i += 1]}: args[i + 1] is a 'unit' ? args[i += 1] : 0
if length(args) > i + 1
{args[i += 1]}: args[i + 1] is a 'unit' ? args[i += 1] : 0
if length(args) > i + 1
{args[i += 1]}: args[i + 1] is a 'unit' ? args[i += 1] : 0
Hello TJ what do you think about adding this line of code to the position helper, most of the time when I use fixed or absolute I fix the top/bottom and stretch the element setting both right and left.