Skip to content

About Variables / Default Variables #515

Open
@HalfLegend

Description

@HalfLegend

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:

// 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."

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions