Production Optimisation
Hey Team,
I've been trying to find a way to increase the speed of my site. It seems that my website is using less than 5% of Brizy's and Brizy Pro's CSS.
I have extracted the CSS in use throughout my site and enqueued it. However I'm really struggling to dequeue the 'brizy-preview' and 'brizy-pro-preview' css files.
I've tried different variations of the following code.
function remove_unused_css()
{
wp_dequeue_style( 'brizy-preview' );
wp_deregister_style('brizy-preview');
wp_dequeue_style( 'brizy-pro-preview' );
wp_deregister_style('brizy-pro-preview');
}
add_action('wp_enqueue_scripts', 'remove_unused_css', 9999);
add_action( 'wp_head', 'remove_unused_css', 9999 );
Can you give me a code snippet to remove these files please?
Thanks in advance!
-
Hi,
I would love to help but we cannot do this. All files in Brizy are required and we can't provide you with a code that would remove any of them. You do any optimization or code modification on your own. Sorry about that :/
0 -
I am talking about the wordpress plugin. It's a totally private website that has nothing to do with Brizy Cloud. Not sure why you can't help me simply remove these CSS files. I am fully aware that this could break the site, so I'll be testing it on a staging site first.
If you cannot help me remove them, can you at least provide me with some understanding of how you're enqueueing them?
Are you using 'wp_enqueue_scripts' and do I have the names correct ('brizy-preview' & 'brizy-pro-preview') for these two files
wp-content/plugins/brizy/public/editor-build/170-wp/editor/css/preview.css
wp-content/plugins/brizy-pro/public/editor-build/55-wp/css/preview.pro.css
Thanks,
0 -
Hi Paul,
try to use the following code:
function remove_unused_css() {
wp_dequeue_style( 'brizy-preview' );
wp_dequeue_style( 'brizy-pro-preview' );
}
add_action( 'wp_enqueue_scripts', 'remove_unused_css', 10001 );
0 -
Paul, would you be so kind and share the results? I recently came across the same problem - my SI is very poor and one reason are those css.
Have you managed to remove them and speed up your site?
Thanks!
0
Please sign in to leave a comment.
Comments
4 comments