Comments (5)
Hi, guys. I transfer this issue from less/less-docs
to less/less.js
just now.
from less.js.
@krsdcbl The reason why this works is because I introduced the idea in Less 3.5 of importing the parser and re-parsing an evaluated value within the selector. So the evaluated value gets re-parsed into a selector. Hence, it's found.
However, I no longer think this is a great idea. Ideally, the parser and evaluation engines are not going back and forth and re-doing work, and they would be distinct stages (other than some very light regex parsing). It just makes the flow a little bit more complicated.
But... it's possible this might be possible without re-parsing (although not with the string example); but it's hard to say, so I'd rather not add this as a documented (supported) feature, as documentation implies future support. So I would call this relying on unsupported behavior which may break in the future.
from less.js.
@iChenLei Note, if this does work, it should still have a Less/CSS test demonstrating the functionality so we can test for regression.
On second thought, I'm wondering if this should be an officially supported feature or not. 🤔
from less.js.
@matthew-dean good point, maybe i did actually stumple upon a bug here 🤔
After some quick testing with https://www.lesstester.com/ - my code sample above:
- doesn't work in LESS 3.0 & older
- does work in LESS 3.5 & newer
Don't really know if its intentional or if it may have possible adverse effects. All I can say is I've been using recently and It's proven very useful in some specific cases, and didn't seem to create any issues (as far as i can currently judge)
from less.js.
@matthew-dean thanks for the explanation! That's a pity, unintenional as it may be its serving me quite well right now :D
But i totally see why this could become a problem when used on a larger scale than my 2-3 components that leverage this to enable extending variants onto the config-defined selectors of their respective base variants.
I guess my specific use is a rather niche application anyway and shouldn't be supported if it goes against the languages conventions & performance standards, or creates unnecessary overhead. I'll annotate the few cases where I used it & expect it to break sometime in the future, thx very much for the insight!
Out of curiosity, and sorry if I'm going off topic: but is this by any chance related to the reason :extend
doesn't take interpolated selectors as a parameter?
from less.js.
Related Issues (20)
- sys import doesn't work with nodejs 18 HOT 3
- Adding a default value to a mixin causes arity match failure HOT 2
- Container style queries unexpected space HOT 8
- Can not find variable when a variable be created in plugin. HOT 2
- Nested @layer rule lost scope HOT 1
- Mixin calls with empty parentheses shouldn't match with classes with the same name
- less variables cannot be used under the not selector, delimiter HOT 1
- 网络安全漏洞修复
- Whether the official statement "Selectors with variables will not match" is wrong? HOT 1
- @font-face doesn't respect scope when compiling HOT 2
- In version 4.2.0, a container query in a mixin that uses a LESS variable doesn't use the right value when the mixin is called multiple times with different values
- `mask-repeat: no-repeat` being transformed into `mask-repeat: initial` in production mode HOT 1
- Empty calculation passed to css in 4.2.0 HOT 4
- less does not compile using vite anymore HOT 1
- Variable interpolation with math operator like + is not compiling properly HOT 1
- Comments with doubleslash are not stripped before compile
- @starting-style doesn't nest correctly HOT 1
- Nested pseudo-selectors that take selectors eport missing a closing ')' when separated by commas
- Lessc to provide preserve comments option
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from less.js.