-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
null value #141
Comments
Nice idea! However, there is another idea I have when I hear So, when you're doing something like So, adding some keyword that would tell Stylus to ignore the property at all would be nice. And the behavior you want can be made by the following mixin: margin()
if null in arguments
margin-top: arguments[0] if arguments[0] != null
margin-right: arguments[1] if arguments[1] != null
if length(arguments) == 2
margin-bottom: arguments[0] if arguments[0] != null
margin-left: arguments[1] if arguments[1] != null
else if length(arguments) == 3
margin-bottom: arguments[2] if arguments[2] != null
margin-left: arguments[1] if arguments[1] != null
else if length(arguments) == 4
margin-bottom: arguments[2] if arguments[2] != null
margin-left: arguments[3] if arguments[3] != null
else
margin: arguments |
Well done on that snippet, I've already put it in my
Marginsmargin()
if null in arguments
margin-top: arguments[0] if arguments[0] != null
margin-right: arguments[1] if arguments[1] != null
if length(arguments) == 2
margin-bottom: arguments[0] if arguments[0] != null
margin-left: arguments[1] if arguments[1] != null
else if length(arguments) == 3
margin-bottom: arguments[2] if arguments[2] != null
margin-left: arguments[1] if arguments[1] != null
else if length(arguments) == 4
margin-bottom: arguments[2] if arguments[2] != null
margin-left: arguments[3] if arguments[3] != null
else
margin: arguments Paddingpadding()
if null in arguments
padding-top: arguments[0] if arguments[0] != null
padding-right: arguments[1] if arguments[1] != null
if length(arguments) == 2
padding-bottom: arguments[0] if arguments[0] != null
padding-left: arguments[1] if arguments[1] != null
else if length(arguments) == 3
padding-bottom: arguments[2] if arguments[2] != null
padding-left: arguments[1] if arguments[1] != null
else if length(arguments) == 4
padding-bottom: arguments[2] if arguments[2] != null
padding-left: arguments[3] if arguments[3] != null
else
padding: arguments |
Bordersborder-color()
if null in arguments
border-top-color: arguments[0] if arguments[0] != null
border-right-color: arguments[1] if arguments[1] != null
if length(arguments) == 2
border-bottom-color: arguments[0] if arguments[0] != null
border-left-color: arguments[1] if arguments[1] != null
else if length(arguments) == 3
border-bottom-color: arguments[2] if arguments[2] != null
border-left-color: arguments[1] if arguments[1] != null
else if length(arguments) == 4
border-bottom-color: arguments[2] if arguments[2] != null
border-left-color: arguments[3] if arguments[3] != null
else
border-color: arguments border-width()
if null in arguments
border-top-width: arguments[0] if arguments[0] != null
border-right-width: arguments[1] if arguments[1] != null
if length(arguments) == 2
border-bottom-width: arguments[0] if arguments[0] != null
border-left-width: arguments[1] if arguments[1] != null
else if length(arguments) == 3
border-bottom-width: arguments[2] if arguments[2] != null
border-left-width: arguments[1] if arguments[1] != null
else if length(arguments) == 4
border-bottom-width: arguments[2] if arguments[2] != null
border-left-width: arguments[3] if arguments[3] != null
else
border-width: arguments border-style()
if null in arguments
border-top-style: arguments[0] if arguments[0] != null
border-right-style: arguments[1] if arguments[1] != null
if length(arguments) == 2
border-bottom-style: arguments[0] if arguments[0] != null
border-left-style: arguments[1] if arguments[1] != null
else if length(arguments) == 3
border-bottom-style: arguments[2] if arguments[2] != null
border-left-style: arguments[1] if arguments[1] != null
else if length(arguments) == 4
border-bottom-style: arguments[2] if arguments[2] != null
border-left-style: arguments[3] if arguments[3] != null
else
border-style: arguments |
Does it make sense to put in a check just to make sure
|
Closing this as part of cleaning out old issues. Feel free to reopen. |
Just an idea:
Stylus:
#foo margin 1em null
CSS:
Stylus:
#foo margin null 1em
CSS:
Stylus:
CSS:
Stylus:
CSS:
The text was updated successfully, but these errors were encountered: