Gutenberg junk revisited
Published February 13th, 2020 under Misc
Almost two years ago, I wrote a post called Disable Gutenberg junk about how to remove extraneous junk CSS added via the Gutenberg plugin (the block editor in WordPress). In it, I said “This will not be a problem if/when Gutenberg is merged into WordPress core, because themes will be able to simply include support by default”. It didn’t dawn on me at the time, that WordPress core would include that CSS automatically too. I thought it was just a temporary solution to help people with testing. That was a poor assumption, as the “junk” made it’s way into most WordPress sites automatically.
If you aren’t using the WordPress block editor or the CSS it adds, then you obviously don’t want every one of your site visitors having to download it. You may also like to bundle your designated block CSS directly into your theme rather than adding it as an extra file.
Updated code for this can be found here:
Remove WordPress block CSS
Sam says:
This disables the wp-block-library-css which is great – should it also do the wp-block-library-theme-css or will that have inadvertent effects?
February 13, 2020 at 9:56 pm # //
Ryan Hellyer says:
I don’t see any reason to think that would have inadvertent effects. If you aren’t using the block library CSS, then it presumably isn’t useful to you.
February 21, 2020 at 3:03 am # //
Rifat Malik says:
Thank you so much, this post is really helpful.
January 23, 2023 at 5:08 am # //
Ryan Hellyer says:
This was updated six days ago, so you may want to check that one too … https://geek.hellyer.kiwi/2023/more-gutenberg-junk/
January 29, 2023 at 2:34 pm # //