简体   繁体   中英

how do add a dot to a variable to be used as selector in less

I'm currently getting this output:

.'teal-dark' { color: #xxx; }

What I want is this: {

.teal-dark { color; #xxx; }

Here is what I'm trying to do:

 @teal-dark: #xxx;
.@{currentMember} div { background: ~"@{@{currentMember}}" };

See: http://lesscss.org/features/#variables-feature-variable-interpolation http://lesscss.org/features/#variables-feature-variable-names and

@current-member: teal-dark;
@teal-dark: red;

.@{current-member} {
color: @@current-member;
}

compiles into:

.teal-dark {
  color: red;
}

Possible relevant questions:

Here's the fix from another post:

    @selector: ~'.@{currentMember}';
    @{selector} div { background: ~"@{@{currentMember}}" };

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM