Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selectors in variables not being parsed #2499

Closed
erquhart opened this issue Mar 11, 2015 · 2 comments
Closed

Selectors in variables not being parsed #2499

erquhart opened this issue Mar 11, 2015 · 2 comments

Comments

@erquhart
Copy link

For example:

@pseudo-states: &:hover, &:active, &:focus;

.my-selector {
  @{pseudo-states} {
    // rules
  }
}

// expected output:
.my-selector:hover, .my-selector:active, .my-selector:focus {
  // rules
}

// actual output:
.my-selector &:hover, &:active, &:focus {
  // rules
}

Is there a way to get Less to parse the selectors?

Note: I'm aware that I could use a mixin and pass the ruleset in, but that's a workaround, and not a great one at that. Awesome feature, but not the proper tool for this job. One specific limitation of that approach comes when other selectors should be added to a specific instance:

// via mixin
.my-selector {
  // can't put additional selectors here
  .pseudo-states({
    // rules
  }, //maybe here as a catch-all arg? feels wrong.);

// via variable
.my-selector {
  .my-other-selector,
  .and-another,
  @{pseudo-states} {
    // rules
  }
}
@seven-phases-max
Copy link
Member

See #1421.

@seven-phases-max
Copy link
Member

Closing as duplicate of #1421.

oyejorge pushed a commit to oyejorge/less.js that referenced this issue Mar 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants