-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Support || operator for variables #318
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
Conversation
…files (server won't serve up .less files)
allows conditional overriding of variable values @someVariable:red; @include "otherfile" =================contents of "otherfile"========= @someVariable:@someVariable||green;
I am wondering whether this is best suited as an an operator or a function? also your pull request includes 2 commits from a different release @MatthewDL @Synchro are you happy for me to close and add a feature request for a function or do you like this? |
What's the use case here? To assign a value only if another LESS file hasn't been imported? Note also that, in this example, @someVariable are both executed in the same scope, so it can't be redefined in this way and refer to itself. It's clear that the author is interpreting LESS more like JavaScript than CSS. So, overall, this has a number of problems which don't feel sufficiently addressed. |
I don't think it's especially useful (why not just set the colour right?), but I think it's another fudge for the lack of conditional structures. |
A mixin guard can actually do this, I believe. |
Yes a guard can do this.. the use case for me is user set theme variables.. Yes, its needed because less doesn't have control structures.. having a But I think the operator is messy.. I prefer a function. |
closing as we all agree operator is not the way to go |
Adds || (boolean or) operator
allows conditional overriding of variable values
@someVariable:red;
@include "otherfile.less"
=================contents of "otherfile.less"=========
@someVariable : @someVariable || green;