Discussion on Interpolation
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 5
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Related to #12. Moved from that issue:
For interpolators, I could see us doing one of two things:
- just use variable interpolation syntax for both:
.class@{#ns[@var]} { }
.class@{#ns[prop]} { }
...but that leaves a redundant @ in the first example:
2. Use a more generic interpolation syntax, such as borrowing from mustache: {{ }} (but could be another pair of something, if the language starts to look too curly-bracy. But used here just to demo concept)
.class{{#ns[@var]}} { }
.class{{#ns[prop]}} { }
// or for local
.class{{@var}} { }
.class{{$prop}} { }
Existing interpolation syntax (1) could be deprecated but still supported throughout 3.x.
For single property accessing, syntax doesn't need to change.
color: red;
border-color: $color;
One possible benefit of adopting a new interpolation syntax is that it doesn't need to just contain identifiers but could, like mustache, contain expressions:
.icon_{{ @startNum + @i + 1 }} { }
That's just a possible benefit, not a necessity.
Response from @seven-phases-max (which I agreed with):
As for the selector interpolation stuff, I would not take it so far yet. It's a big story on its own.
After all, the@{}syntax initially was invented for strings only, then when(~"@{var}")(almost accidentally) was found to also be usable in selectors, it was decided to be reduced to just@{var}.
The biggest problem with those curly braces in selectors is that they really make things harder to read because of the same symbol used for CSS{}block itself. So while@{}found its way to selector interpolation for some historical reasons, if we are about inventing a new syntax (especially if it's targeting for an arbitrary Less statements to appear there), the{{ }}is the last thing I'd vote for (ref.).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading related issue #12 and the referenced discussion in pull request #1648. The issue presents alternative interpolation syntaxes and explicitly defers selector interpolation, but names no files or tests. A maintainer decision and acceptance criteria are needed before implementation can be considered done.
Written by the indexing model from the issue text.
Assessment
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 15/100