less4clj icon indicating copy to clipboard operation
less4clj copied to clipboard

Using "&" parent selector + Double-hyphens in a class name causes the compiler to fail

Open egesd opened this issue 2 years ago • 1 comments

I noticed weird behaviour when naming my CSS classes with BEM-naming convention, using & and double hyphens. When naming my classes in a following way

.foo { &__bar { &--baz { } } }

the error occurs

ERROR file:/** 260:8 mismatched character 'b' expecting '>' 259: &__bar { 260: &--baz { 261:

When using the double hyphens without the "&" parent selector, it seems to be working fine.

To add: it also works with .foo__bar--baz so the problem isn't the double hyphens, but the combination of &-selector and double hyphens.

egesd avatar Apr 13 '22 10:04 egesd

I don't know if this has been supported in Less.js since some new versioon, but seems like less4j difference or just not implemented.

As less4j has been deprecated, this isn't going to be fixed.

https://github.com/SomMeri/less4j/wiki/Differences-Between-Less.js-and-Less4j

Deraen avatar Apr 13 '22 10:04 Deraen