Removing all default WordPress CSS styles

The weet theme is extremely fast. One of the ways to achieve this, is by not loading any of the styles that are shipped with WordPress.

After updating to WordPress version 6.4, I noticed that a stylesheet was loading with this theme. Apparently a new stylesheet was introduced. I used the excellent Query Monitor plugin to tell me where this was loaded. Turns out that a separate stylesheet for components exists.

Query monitor panel showing CSS source link for the wp-components handle

In classic themes you can remove stylesheets with PHP if you know the appropriate handle.

function my_dequeue_styles() {
  wp_dequeue_style( 'global-styles' );
  wp_dequeue_style( 'wp-block-library' );
  wp_dequeue_style( 'classic-theme-styles' );
  wp_dequeue_style( 'wp-components' );
}
add_action( 'wp_enqueue_scripts', 'my_dequeue_styles', 10, 0 );

In that case you also have to provide your own CSS.

It seems that I have to keep my eye on changes in WordPress and update the weet theme accordingly.