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

Parent Selector ('&') will not combine non-keywords #119

Open
rayanth opened this issue Oct 5, 2021 · 0 comments
Open

Parent Selector ('&') will not combine non-keywords #119

rayanth opened this issue Oct 5, 2021 · 0 comments

Comments

@rayanth
Copy link

rayanth commented Oct 5, 2021

Ref https://lesscss.org/features/#parent-selectors-feature there is no indication that there needs to be a - to join two words into one, like their example shows.

In a shortened version of their example this:

.button {
    &-OK {
        background-image: url("ok.png");
    }
}

Should compile to :

.button-OK {
  background-image: url("ok.png");
}

This works properly in lesscpy.

What does NOT work, is the following:

.button {
    &OK {
        background-image: url("ok.png");
    }
}

(notice the removal of the -)
Should compile to:

.buttonOK {
  background-image: url("ok.png");
}

Instead, in lesscpy, it results in:

Syntax Error, token: `css_ident`, `ok`
Syntax Error, token: `t_bclose`, `}`

In other LESS parsers, this compiles fine.

Note that if the second word is a valid DOM element, e.g. 'Div', it will work in lesscpy:

.button {
    &Div {
        background-image: url("ok.png");
    }
}

correctly results in:

.buttonDiv {
  background-image: url("ok.png");
}
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

1 participant