Skip to content
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

$@ (Variable properties) should be documented #500

Open
ayyash opened this issue Jan 10, 2019 · 3 comments
Open

$@ (Variable properties) should be documented #500

ayyash opened this issue Jan 10, 2019 · 3 comments

Comments

@ayyash
Copy link

ayyash commented Jan 10, 2019

Under maps, section named: Using variable variables in lookups references lookups, not maps, so when I tried to apply it, the code looks like this

@foods: {
    dessert: ice cream; // Turn into a map
};
@key-to-lookup: dessert;
.lunch {
    treat: @foods[@@key-to-lookup];
}

Compilation result: variable @dessert not found. So if variable variables are not applicable to the new Maps, it should be removed from documentation.

@matthew-dean
Copy link
Member

@ayyash You have defined dessert as a property, not a variable (there's no such "key" as @dessert, therefore you need the property variable syntax, as follows:

@foods: {
    dessert: ice cream; // Turn into a map
};
@key-to-lookup: dessert;
.lunch {
    treat: @foods[$@key-to-lookup];
}

Properties are referenced using $ or the plain name, but to look up a variable property, you need $@

@matthew-dean matthew-dean changed the title Map documentation references invalid scenario $@ (Variable properties) should be documented Jan 10, 2019
@matthew-dean
Copy link
Member

Updated the description as I don't think variable properties are currently documented, even though this functionality exists.

@matthew-dean
Copy link
Member

See: less/less.js#3362

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants