-
Hello, I have done a simple website with a few pages, with a simple mkdocs.yml (see below) and I'm surprised to find that the compiled main.css file is a massive 126KB (zips down to about 20+K), with another 13KB palette.css file as well. Looking into it, it appears to include CSS that's not at all used on the site. In addition, commenting out all features and markdown_extensions do not change at all the built CSS files, the CSS is exactly the same. Is there a way to apply purgeCSS or similar as part of the build to get rid of all unused selectors? Thanks and regards mkdocs.yml:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 11 replies
-
The CSS is bundled at the time the theme is built, so it would be difficult to unpack this. It is conceivable to identify any larger components and break them out. Having said that, can you explain why 126KB that gets loaded once and then cached is troublesome? Bear in mind that I am not a web designer, so have no sense of measure here. When I look at the log of network activity for some commercial sites, Material looks pretty lean and mean in comparison. The only reason pages take any time at all to load is because I run a lone AWS instance and not a CDN. |
Beta Was this translation helpful? Give feedback.
-
No problem, I still prefer reducing all that's sent over the wire but I'm happy adding PurgeCSS was simple and does the job. |
Beta Was this translation helpful? Give feedback.
-
How could that be used in GitHub actions? It seems |
Beta Was this translation helpful? Give feedback.
Via a system call, definitely. However, it's nothing we consider adding to our code base, because Node.js as a new dependency will throw a lot of people off. This piece of software is so popular because it doesn't need a JS runtime.
We're not considering adding this to our documentation, as it's the very first time we heard of this and don't consider it a common case. 20kb gzipped is absolutely okay, IMHO, so likely not a big problem for 99% of users.