csscomb.js icon indicating copy to clipboard operation
csscomb.js copied to clipboard

Get "Cannot read property 'first' of null" error with :root selector

Open maliyshock opened this issue 3 years ago • 0 comments

I tried to use 4.2.0 version of CSS comb, and I got this error

"comb": "node node_modules/csscomb/src/cli.js -c .csscomb.json src/scss",

csscomb/lib/options/sort-order.js:163
let property = node.first('property').first();
                                    ^
TypeError: Cannot read property 'first' of null

I believe the problem occurs when you are trying to use :root selector.

The same thing happens here https://gitmemory.com/issue/csscomb/csscomb.js/625/820750672 The workaround is to use

"devDependencies": {
    "csscomb": "csscomb/csscomb.js#1f27f9e4e0f6a9f0849b6fc6e8325baf9371aeaf"
}

and

"scripts": {
    "comb": "node node_modules/csscomb/src/cli.js -c .csscomb.json src/scss",
}

I would be happy to use CSS comb without that kind of patches. Thanks!

maliyshock avatar Sep 14 '21 13:09 maliyshock