In updating to Wordpress 5.0.1 I noticed when examining my Sources from Chrome's DevTools that a new file and directory were created, a stylesheet named style.min.css in a dist directory:
/wp-includes/css/dist/block-library
style.min.css
From research and memory there is wp_dequeue_style()
and I can do:
add_action('wp_print_styles',function() {
wp_dequeue_style('wp-block-library');
},100);
that removes the file from Source but I'm unsure on a custom theme if there are any adverse effects or another way to remove the file? Is there another way to remove Gutenberg CSS from WordPress 5.0.1 and if I dequeue will that cause any problems?
Here are some Github issues I found when searching:
- How to remove gutenberg CSS
- Column Block CSS Media Query
In updating to Wordpress 5.0.1 I noticed when examining my Sources from Chrome's DevTools that a new file and directory were created, a stylesheet named style.min.css in a dist directory:
/wp-includes/css/dist/block-library
style.min.css
From research and memory there is wp_dequeue_style()
and I can do:
add_action('wp_print_styles',function() {
wp_dequeue_style('wp-block-library');
},100);
that removes the file from Source but I'm unsure on a custom theme if there are any adverse effects or another way to remove the file? Is there another way to remove Gutenberg CSS from WordPress 5.0.1 and if I dequeue will that cause any problems?
Here are some Github issues I found when searching:
- How to remove gutenberg CSS
- Column Block CSS Media Query
- In the admin, or the front-end? Why do you want to dequeue it? It's presumably loaded for a reason. – Jacob Peattie Commented Dec 18, 2018 at 3:48
- @JacobPeattie By that logic you're also ok with using emojicons? I haven't played or learned much of Gutenberg yet which is why I asked. – user9447 Commented Dec 18, 2018 at 3:50
- 1 If you're going to use the classic editor, it should be safe to remove it. But sooner or later you need to enqueue it again, since the classic editor won't be a permanent solution. – Johansson Commented Dec 18, 2018 at 3:52
1 Answer
Reset to default 1You probably do not need to dequeue it if you do not use gutenberg. It should be used only with the block editor. Obviously there might be bugs, but if you are using the classic editor plugin to avoid the gutenberg **** you can open a bug report with it.
But there is nothing wrong with dequeuing it if you decide to disable gutenberg "by hand", or you can not be bothered to wait until relevant bugs are fixed.
A notice regarding the future is probably needed here. As wordpress wants to have everything as blocks this CSS might get reused in other parts of the system in the future, therefor as always, be careful in which context you dequeue the CSS.