Although they have announced that in future versions they will stop using lity.css, the reality is that right now the best cookie and GDPR compliance plugin there is, GDPR Cookie Compliance, uses Lity, which sometimes slows down the speed of the websites quite a lot, sometimes up to 8 or 9 seconds.
And this is because the plugin loads Lity from the following paths, with the peculiarity that generally its loading cannot be postponed, nor compressed:
However, for the time being, the same authors of the plugin recommend using a couple of actions that, added to the functions.php file of the active theme or to your customization plugin, can greatly improve the loading times of your website, despite Lity.
These are these lines:
/* Optimize load GPR plugin lity.css */ add_action( 'gdpr_enqueue_lity_nojs', '__return_false' ); add_action( 'gdpr_cc_prevent_ajax_script_inject', '__return_true' );
Once you save the changes you can check that they improve both the loading times of your website and the score in Lighthouse, and although this website didn’t get a huge improvement(around 2 points) due to it being a testing website, yours should have a bigger improvement.
With this method, you will see that lity.css becomes a really light resource, that hardly affects the speed of your web.
Read this post in Spanish: Acelera la carga de tu web controlando lity.css GDPR Cookie Compliance