The files here provide examples of the variable and property accessor syntax currently being discussed at less.js#1848.
@{ #ns > var }
${ prop }
${ #ns > prop }
- Enable accessing namespaced variables with
@{#ns var}
(see accessor.initial.less, #1848). - Enable accessing local and namespaced properties with,
$prop
,${prop}
and${#ns prop}
(see #2433, #76, #6). - In the next major version, enable syntax sugar
#ns@var
, and#ns$prop
, allowed where plain variables (e.g.@var
) are allowed.
- accessor.initial.less Summarizes the minimum feature, enabling accessing namespaced variables. Safe for immediate implementation.
- accessor.summary.less The full proposed feature, including accessing namespaced variables as well as local and namespaced properties, and some syntax sugar.
I don't know. It seems like it may overcomplicate things, using the same symbol for selector reference and property access. I do think it's important to be able to save selectors, though. I'm not sure how that'd be accomplished, though. But it seems like that could be just a function.
The function could be a lot of things, and would provide a more semantic way to denote what's happening:
sel()
,selref()
,sref()
,selector()
, etc. I think a function would be appropriate, since I think the readability benefit is worth the extra characters.