Replies: 1 comment 1 reply
-
Hey @keturn! I'm Dosu, a bot here to help you with bug fixes, answer questions, and guide you on becoming a contributor. Feel free to ask me anything while waiting for a human maintainer to assist you. To perform a lookup from a map or namespace in a selector in Less, you can use the Here's an example of how you can use map or namespace lookups in Less: #colors() {
primary: blue;
secondary: green;
}
.button {
color: #colors[primary];
border: 1px solid #colors[secondary];
} This compiles to: .button {
color: blue;
border: 1px solid green;
} However, when it comes to using these lookups directly in selectors, Less might not support this syntax directly. Instead, you can assign the result of the lookup to a variable and then use that variable in your selector. Here's a workaround: @fruity: .drupe, .berry;
#my-ns() {
@fruityVar: .drupe, .berry;
}
@fruitySelector: #my-ns[@fruityVar];
div :is(@{fruitySelector}) {
color: red;
} This approach involves storing the result of the lookup in a variable and then using that variable in the selector. This should help you avoid the "Unrecognized Input" error you're encountering [1][2]. |
Beta Was this translation helpful? Give feedback.
-
In a selector, how do I look up a value from a map or namespace?
Everything I've tried so far has failed with "Unrecognized Input" in the playground.
[copy of sample code here, since less-preview links haven't been loading content their encoded content for me.]
Beta Was this translation helpful? Give feedback.
All reactions