Archived topic
Dynamic CSS Print Method
7 replies · Started by Adam on June 19, 2021
Hello, I am playing with my settings and noticed my theme was set to "Inline Embedding" under the Dynamic CSS Print Method (under general settings). Should I switch this to "external file"? to increase performance?
One thing I am getting dinged on a lot on page speed insights is "reduce unused CSS"- I'm not sure if this would fix that....
(Note: I am running Autoptimize and WP Super cache...those both did seem to help)
Thanks!
Hi there,
that option only applies to the dynamic CSS ( customizer settings ) generated by the Theme. But it won't remove unused CSS - which in regards the the theme CSS would be tiny.
I checked the site attached to your license and the largest chunk of CSS i can see is related to the Woocommerce Blocks - are you using the Woocommerce Block Plugin and are you adding those blocks to a page anywhere ? If you have the plugin installed but not using it - disable it
Hi David- thank you for the clarification on the CCS.
I did install WooCommerce about two weeks ago and have it set up on my sho page. But, I do not have WooCommerce Blocks installed (that I know of...). Unless its bundled in with the main Woocommerce plugin?
Can you disable Autoptimize and WP Cache so i can see where that CSS is being loaded from
Hi David- I just disabled them....thanks for looking into this!
Ah i forgot - Woocommerce actually packages the Blocks stylesheet as part of the core plugin.
Are you using any Woocommerce Blocks in your static pages?
If you're not - then you can add this PHP Snippet to remove the entirely:
function slug_disable_woocommerce_block_styles() {
wp_dequeue_style( 'wc-block-style' );
}
add_action( 'wp_enqueue_scripts', 'slug_disable_woocommerce_block_styles' );
That style sheet probably accounts for 50%+ of the CSS the site is loading...
Hi David- are the Woocommerce blocks like featured images, etc I can embed into posts? Like this: https://panfishnation.com/warmouth-vs-rock-bass/
If so, yes I guess I am using them. That was my first time using them anyway.... but if its going to cause a lot of problems maybe I wont.
Hi Adam,
It's this one within the post that is using WooCommerce Blocks. - https://share.getcloudapp.com/kpuDDDGR
Dequeuing the style would affect this block. :D