You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm testing MinimalCSS on a site that's using Id attribute in the main navigation. MinimalCSS is not including the corresponding css. This is a WordPress theme.
Do you have a URL I can test this against?
Or better can you clone minimalcss locally and debug why it's claiming certain selectors are not present in the DOM.
▶ ./bin/minimalcss.js https://www.smcgroup.io/
Error: Invalid CSS found while evaluating https://www.smcgroup.io/wp-content/litespeed/cssjs/b3856.css?50a30: ".flat-top. ul.nah-socials li"
at Object.enter (/Users/peterbe/dev/JAVASCRIPT/minimalcss/src/run.js:563:19)
at Object.<anonymous> (/Users/peterbe/dev/JAVASCRIPT/minimalcss/node_modules/css-tree/lib/walker/create.js:11:16)
at List.walkNode (/Users/peterbe/dev/JAVASCRIPT/minimalcss/node_modules/css-tree/lib/walker/create.js:161:19)
at List.each (/Users/peterbe/dev/JAVASCRIPT/minimalcss/node_modules/css-tree/lib/common/List.js:158:12)
at Object.StyleSheet (/Users/peterbe/dev/JAVASCRIPT/minimalcss/node_modules/css-tree/lib/walker/create.js:106:29)
at walkNode (/Users/peterbe/dev/JAVASCRIPT/minimalcss/node_modules/css-tree/lib/walker/create.js:164:37)
at Object.walk (/Users/peterbe/dev/JAVASCRIPT/minimalcss/node_modules/css-tree/lib/walker/create.js:220:9)
at /Users/peterbe/dev/JAVASCRIPT/minimalcss/src/run.js:546:13
at Array.forEach (<anonymous>)
at Object.minimalcss [as run] (/Users/peterbe/dev/JAVASCRIPT/minimalcss/src/run.js:532:12)
Since I wasn't passing a value for "withoutjavascript", it seems the the value was being set to false. If I set the value of "withoutjavascript" to true (or comment that line out), then the final css does include the missing css selectors.
I've used the default options above for a bunch of websites and I didn't have issues. I will need to re-test those websites again to see if omitting the flag will make a difference.
Maybe I don't exactly understand your point. (But I get that it works now when you do a render without JS).
If the README is wrong/misleading, would you mind contributing a quick PR to update it so the "next you" don't fall into the same trap?
I think it's more like me not understanding that not passing a value through the command line and having the code expecting the parameters (through argv statement) results in the parameter being set to false.
Activity
peterbe commentedon Jan 20, 2021
Do you have a URL I can test this against?
Or better can you clone
minimalcsslocally and debug why it's claiming certain selectors are not present in the DOM.nubranch commentedon Jan 20, 2021
Hi Peter. Here's a sample URL:
https://www.smcgroup.io/
peterbe commentedon Jan 20, 2021
You can see the error here too: https://minimalcss.app/?url=https%3A%2F%2Fwww.smcgroup.io%2F
nubranch commentedon Jan 20, 2021
I find that quite a few themes have css errors, so I've enabled ignoreCSSErrors to avoid not getting the css output.
peterbe commentedon Jan 20, 2021
I tried this:
And if I inspect the CSS that prints out, I do see:
that's one of the selectors you claimed didn't make it in the minimal CSS.
nubranch commentedon Jan 20, 2021
Thanks for sharing the code.
I have been using the js code that was part of the npm install, which includes the following options:
Since I wasn't passing a value for "withoutjavascript", it seems the the value was being set to false. If I set the value of "withoutjavascript" to true (or comment that line out), then the final css does include the missing css selectors.
I've used the default options above for a bunch of websites and I didn't have issues. I will need to re-test those websites again to see if omitting the flag will make a difference.
thanks.
peterbe commentedon Jan 21, 2021
Maybe I don't exactly understand your point. (But I get that it works now when you do a render without JS).
If the README is wrong/misleading, would you mind contributing a quick PR to update it so the "next you" don't fall into the same trap?
nubranch commentedon Jan 22, 2021
I think it's more like me not understanding that not passing a value through the command line and having the code expecting the parameters (through argv statement) results in the parameter being set to false.