-
Notifications
You must be signed in to change notification settings - Fork 86
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
Suggestion: Stop loading wp-block-library-css when active #77
Comments
Yeah, this was suggested a few times. I'm reluctant to add it to this plugin as it may cause problems with themes that expect these styles, and it seems there will be more and more themes like that. Removal of these styles can be done easily from another (custom?) plugin but I'd suggest it only for people that know what they are doing :) |
Hehe, custom, as it will be just few lines of code. There are several ways to add "hacks" to WP. For some (dumb) historical reasons the most popular is to add stuff to the theme's Much better option is to make a tiny plugin and drop it in |
@azaozz - I realise that this is closed (sorry), but could we consider having the option to disable the Block Library CSS if the concern is that doing this by default might break themes? If a user is using the Classic Editor, there is a good chance they won't want the Block Library CSS, so is the option to disable it something worth considering? Happy to make a separate issue specifically for an optional (and not enabled by default) toggle to disable the Block Library CSS if you'd like me to. |
Agree Just for future reference: #7776 |
Have to agree with @edadams and @hacknug here, this really isn't something that we should have to take care of ourselves. I only spotted this as part of a routine yearly performance audit of one of our largest clients' sites; I had no idea this enqueue had been left in! I know we're only talking about a single HTTP request of around ~6KB gzipped, it is a render blocking enqueue which would be nice to avoid out of the box. |
@azaozz Why is this issue closed? I too agree that since Gutenberg is now the default, and WordPress assumes it will need its resources, dequeuing them is the responsibility of the Classic Editor plugin. Please also dequeue block-related resources added by other plugins, like WooCommerce and Jetpack. |
If it helps, here is the code that does it:
I've tested this code in a plugin and it removes WP and WC scripts, so it should remove any other assets hooked onto 'enqueue_block_assets'. |
To be safe you could wrap few conditions around too to check if plugin and settings are enabled.
|
Hi,
I noticed that even when these settings are applied:
Default editor for all users
:Classic Editor
Allow users to switch editors
:no
WordPress is still loading the
wp-block-library-css
CSS. Stylesheets are render blocking, so every site which isn't quite ready for Gutenberg yet, or has an old theme which disables it is needlessly delaying the user from seeing their page.This could be fixed by dequeuing the stylesheet WordPress/gutenberg#7776 (comment) along with some extra checks: https://gist.github.com/toshotosho/109ec080dcffbb711be4d0f0db99d5f5
There is already a plugin support thread here https://wordpress.org/support/topic/gutenberg-block-css/
I like Gutenberg and will be ready to use it on new projects soon However I have a lot of old projects which will never use Gutenberg that are still maintained and kept up to date.
The text was updated successfully, but these errors were encountered: