Website page speed is crucial to get higher rankings. These days, more and fancier layout designs have bloated the css files to new promotions and in WordPress themes sometimes these files are not even used and they add to page load unnecessarily. If you are fighting to remove every single unused bit of css code from your website to try to achieve high score in Google PageSpeed Insights under mobile view, read on.
Reducing unused CSS for Page speed is a critical factor in ranking your website higher on Google’s search engine results. To dequeuing / remove Gutenberg Block Library CSS additional files, and if you think your website is not using Gutenberg elements, except paragraph and image elements, add following code in your functions.php file.
//Disable Gutenberg styles on Frontend
function pim_remove_theme_assets() {
wp_dequeue_style('wp-components');
wp_deregister_style('wp-components');
wp_dequeue_style( 'wp-block-library' );
wp_dequeue_style( 'wp-block-editor' );
}
add_action( 'wp_enqueue_scripts', 'pim_remove_theme_assets');
Hope that helps.