5.2.0. Beta 1 - Initial feedback

Doing that would definitely help trim out unused styles but you’d need to roll your own CSS for things like

  • Box sizing reset
  • Basic Form styling
  • All root typography options like font sizes, font families, etc.
  • Content/blog styling (headings, paragraphs etc.)
  • Classes used to hide elements per breakpoint.

One thing you could do is run the Integrity stylesheet through a CSS prettifier (to unminify it) then carve out sections you don’t think you need. It’s quite off the beaten path so I wouldn’t recommend it as part of a site building process if you’re making several sites, but it might be worth experimenting with on one site where you’re trying to heavily optimize it.

Sure @Maratopia_Digital

Here’s the code I use.

add_action('wp_enqueue_scripts', 'dequeue_themeco_unused_styles', 100);
function dequeue_themeco_unused_styles()
{
    wp_dequeue_style('x-stack');
    wp_deregister_style('x-stack');
}

add_action('after_setup_theme', 'remove_x_output_generated_styles', 10);
function remove_x_output_generated_styles()
{
    remove_action('wp_enqueue_scripts', 'x_output_generated_styles', 9998);
}

My hope is an equivalent remains or is provided for x_output_generated_styles, in the Theme Options Reboot, @alexander is something you’re able to comment on? Granted if the Theme Options Reboot natively generates lean inline CSS there is may not be such a strong need for this.

Dequeuing the stack style sheet I’ve been able to reduce the file size to around 35%-40% of original size depending on the site. The process is exactly as @alexander describes and then enqueque the customised css, normally from the child theme.

Nice job! It’s too early to know for sure but the Theme Options reboot will likely include a much smaller static CSS file, and a small amount of Global Generated CSS which will mostly be for setting up media queries for root typography. It should be possible to opt-out of everything else by turning off features. Again, not really sure how all of that will look, but certainly much smaller than the current styles since nothing opinionated will be static.

3 Likes