You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This feature is not required because you can easily override a variable by putting the definition afterwards.
For instance:
// library@base-color: green;
@dark-color: darken(@base-color, 10%);
// use of library@import"library.less";
@base-color: red;
This works fine because of Lazy Loading - base-color is overridden and dark-color is a dark red.
I don't think the behavior in the example meets the instruction, because the @base-color is already set to green, it shouldn't be reset to red.
So I think the instruction should be:
" We sometimes get requests for default variables - an ability to set a variable only if it is not already set.
This feature is conflicted with 'overriding a variable by putting the definition afterwards', so we couldn't implement the behavior of default variables."
The text was updated successfully, but these errors were encountered:
so we couldn't implement the behavior of default variables."
Well, we could. It just would make no sense in Less. For more details on this see less/less.js#1706
I don't think the behavior in the example meets the instruction, because the @base-color is already set to green, it shouldn't be reset to red.
I'm not sure I understand what you actually mean with this. Could you elaborate?
Note that Less overriding is not a replacement for Sass !default. It's a different paradigm to achieve a desired behavior for similar use-cases (in other words: !default is a kludge required in Sass to achieve the things naturally existing in Less by design. Nothing more than this).
http://lesscss.cn/features/#variables-feature-default-variables
It writes:
We sometimes get requests for default variables - an ability to set a variable only if it is not already set.
This feature is not required because you can easily override a variable by putting the definition afterwards.
For instance:
This works fine because of Lazy Loading - base-color is overridden and dark-color is a dark red.
I don't think the behavior in the example meets the instruction, because the @base-color is already set to green, it shouldn't be reset to red.
So I think the instruction should be:
" We sometimes get requests for default variables - an ability to set a variable only if it is not already set.
This feature is conflicted with 'overriding a variable by putting the definition afterwards', so we couldn't implement the behavior of default variables."
The text was updated successfully, but these errors were encountered: