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

TypeError: Cannot read property 'each' of null #342

Closed
slackero opened this issue Jun 12, 2017 · 4 comments
Closed

TypeError: Cannot read property 'each' of null #342

slackero opened this issue Jun 12, 2017 · 4 comments

Comments

@slackero
Copy link

slackero commented Jun 12, 2017

I have a CSS file which is processed well in CSSO 2.3.2 while results with error TypeError: Cannot read property 'each' of null in CSSO 3.1.1. Is not working with csso-cli and not online.

styles.css.zip

@lahmatiy
Copy link
Member

The problem occur because you're using :not w/o parenthesis on line 9025:

.nav-sidebar .navbar-nav:not {
  display: block;
}

It's a dead code. If you fix it, compression will perform as expected.

Anyway, CSSO should output more useful errors (if any). Need to be improved.

@slackero
Copy link
Author

Great, thanks for your fast feedback and help. Works as expected now.

@Nakilon
Copy link

Nakilon commented Sep 28, 2020

$ csso small.css --output tiny.css
/usr/local/lib/node_modules/csso-cli/index.js:299
            throw e;
            ^

TypeError: Cannot read property 'each' of null
    at List.walk (/usr/local/lib/node_modules/csso-cli/node_modules/csso/lib/restructure/prepare/specificity.js:25:39)
    at List.each (/usr/local/lib/node_modules/csso-cli/node_modules/css-tree/lib/common/List.js:158:12)
    at specificity (/usr/local/lib/node_modules/csso-cli/node_modules/csso/lib/restructure/prepare/specificity.js:6:29)
    at List.<anonymous> (/usr/local/lib/node_modules/csso-cli/node_modules/csso/lib/restructure/prepare/processSelector.js:79:40)
    at List.each (/usr/local/lib/node_modules/csso-cli/node_modules/css-tree/lib/common/List.js:158:12)
    at freeze (/usr/local/lib/node_modules/csso-cli/node_modules/csso/lib/restructure/prepare/processSelector.js:25:27)
    at Object.processRule (/usr/local/lib/node_modules/csso-cli/node_modules/csso/lib/restructure/prepare/index.js:14:13)
    at Object.<anonymous> (/usr/local/lib/node_modules/csso-cli/node_modules/css-tree/lib/walker/create.js:11:16)
    at List.walkNode (/usr/local/lib/node_modules/csso-cli/node_modules/css-tree/lib/walker/create.js:161:19)
    at List.each (/usr/local/lib/node_modules/csso-cli/node_modules/css-tree/lib/common/List.js:158:12)

I have the same uninformative error with this file. It's saved Youtube page CSS after UnCSS.

small.css.zip

@usabe
Copy link

usabe commented Sep 6, 2021

@Nakilon

On the lines of 1823 and 2571, there are 3 instances of :not without parenthesis, such as : :not[button-raised] & :not[collapsible]

Just came across this when trying to find out the root cause of the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants