I am writing this LESS file, and I'm kind of stuck.
The code is as follows:
.flag (@code) {
(~'.@{code}') {
+ label {
&:after {
background-image: url('images/flags/@{code}.png');
}
}
}
}
input[type='radio'] {
&.flag {
.flag(us);
}
}
This is creating the following CSS right now (note the space between .flag and .us)
input[type='radio'].flag .us + label:after {
background-image: url('images/flags/us.png');
}
However, the result I'm looking for should look like this:
input[type='radio'].flag.us + label:after {
background-image: url('images/flags/us.png');
}
Obviously I need a combinator (&) somewhere. But I can’t understand exactly where. Everything that I have tried so far leads either to parsing errors or to undesirable results. Is it even possible to start with?
Any help would be appreciated.
source
share