csscomb / csscomb.js

CSS coding style formatter
http://csscomb.com/
MIT License
3.29k stars 458 forks source link

LESS mixins and CSS guards implementation #553

Open matthieupetel opened 6 years ago

matthieupetel commented 6 years ago

Using LESS, it seems that writing mixins and css guards (the when / when not keywords, as described in the documentation here) causes a warning about code validity.

Example of code used :

.class {
  // CSS guard
  & when (@variable1 = @variable2) {
    // ... Properties here...
  }
}

The CSSComb output :

(node:22244) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Parsing error: Assets/less/imports/file.less
Please check validity of the block starting from line #35
CSScomb Core version: 4.2.0

33 |     .class {
34 |       // CSS guard
35*|       & when (@variable1 = @variable2) {
36 |          // ... Properties here...
37 |       }

Syntax: less
Gonzales PE version: 3.4.7

The same error occurs when using when not keyword, either in mixin guard or css guard.

Could it be possible to implement these useful LESS features ?

npm version : 5.5.1 CSSComb version : 4.2.0

jdalton commented 5 years ago

Looks like gpe is missing support for when and when not in LESS.