-
Notifications
You must be signed in to change notification settings - Fork 35
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
Issue with Id Attribute #408
Comments
Do you have a URL I can test this against? |
Hi Peter. Here's a sample URL: |
You can see the error here too: https://minimalcss.app/?url=https%3A%2F%2Fwww.smcgroup.io%2F |
I find that quite a few themes have css errors, so I've enabled ignoreCSSErrors to avoid not getting the css output. |
I tried this: const prettier = require('prettier');
const minimalcss = require('.');
minimalcss
.minimize({
url: 'https://www.smcgroup.io/',
ignoreCSSErrors: true,
})
.then((result) => {
const codeBefore = result.finalCss;
// console.log(codeBefore);
codeAfter = prettier.format(codeBefore, {
semi: true,
parser: 'css',
});
console.log(codeAfter);
}); And if I inspect the CSS that prints out, I do see: #mainnav ul li,
#mainnav > ul > li > a,
.header,
.nav-wrap,
.wrap-header-style4 {
position: relative;
} that's one of the selectors you claimed didn't make it in the minimal CSS. |
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. |
Maybe I don't exactly understand your point. (But I get that it works now when you do a render without JS). |
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. |
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.
HTML: mainnav attribute used in nav below:
Original CSS: (this is all missing from final CSS)
The text was updated successfully, but these errors were encountered: