Archived topic
How to get rid of block-library/style.min.css
7 replies · Started by Bernhard on July 24, 2022
Hello, I extracted the critical CSS of the style.min.css as described here and inserted it in a hook before header called Preload style.min.css. Now I want to defer /wp-includes/css/dist/block-library/style.min.css but I don't know how to.
I tried with <link rel="stylesheet" href="/wp-includes/css/dist/block-library/style.min.css" media="print" onload="this.media='all'"> but maybe it does not work or I don't use it correct in Elements.
Thank you,
Hi Bernhard,
Can you tell me what's your purpose of doing all this?
I'm trying to figure out what you want to achieve.
Let me know!
Hi Ying,
it's to reduce LCP. Pagespeed insight gives me this CSS file with a size of 12,9 KiB and potential savings of 12,8 KiB.
Hi Bernhard,
For reference, see David’s response here: https://generatepress.com/forums/topic/remove-unused-css/#post-980539
Also see to dequeue style.min.css: https://generatepress.com/forums/topic/is-there-any-way-to-reduce-the-size-of-style-min-css-main-min-css-columns-min/#post-1862477
Hope this helps!
Very good, thank you :)
You’re welcome Bernhard! :)
After testing the new setup, I believe that the file block-library/style.min.css is not necessary when building a site from scratch with GenerateBlocks Pro. Currently I still use the old image block and the spacer, but it can easily be replaced with the various formatting options in GenerateBlocks Pro and the new image block is much more powerful. Eliminating block-library/style.min.css and inserting a few lines of CSS for the old images and the spacer brought my LCPs to green in PSI on most of my pages, even having a lot of JS originated by Ezoic Ads.
That’s great to hear! Thank you for sharing!