dynamic class selector variables

Damon Thomas's Avatar

Damon Thomas

03 Jan, 2012 10:21 PM

I need to define a dynamic class selector value and was hoping I could use a less variable to make this work. Unfortunately, it doesn't appear to be valid. Can anyone advise on whether I'm doing something wrong or if this simply isn't supported.

for instance, if I normally have a definition like:

.superman .fly { ...}

but I'd like for the "superman" class selctor to be dynamic, like:

@superhero .fly {...} where "superhero is defined as @superhero: ".superman". This gives compilation errors. Any suggestions for how this could work?

  1. 1 Posted by lunelson on 09 Feb, 2012 11:16 AM

    lunelson's Avatar

    The trick might be this, or would seem to be, given the documentation at lesscss.org:

    @superhero: ".superman";

    @{superhero} .fly {...}

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac