Title: Async/defer CSS
Last modified: May 23, 2021

---

# Async/defer CSS

 *  Resolved [lauratraveler](https://wordpress.org/support/users/lauratraveler/)
 * (@lauratraveler)
 * [5 years ago](https://wordpress.org/support/topic/async-defer-css/)
 * Hi,
 * Is it possible to async/defer the CSS of the plugin? I’m getting ‘Avoid chaining
   critical requests’ in PageSpeed Insights and the /cookie-law-info-gdpr.css, cookie-
   law-info-table.css and cookie-law-info-public.css are on the list. I can’t imagine
   that all 3 CSS files are being needed for the first popup screen (the one with‘
   We use cookies on our website to give you the most relevant experience’).
 * The ‘Privacy Overview’ is not even present on the screen when the page loads 
   in the browser, so I believe the CSS for the ‘Privacy Overview’ can be asynced/
   deferred without any issues. Also, another option would be to maybe combine some
   of the CSS files since they are pretty small?
 * Which option would be best.
 * Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [WebToffee](https://wordpress.org/support/users/webtoffee/)
 * (@webtoffee)
 * [5 years ago](https://wordpress.org/support/topic/async-defer-css/#post-14475169)
 * Hi [@lauratraveler](https://wordpress.org/support/users/lauratraveler/),
 * We can help with the custom development. Please try adding the code snippet [here](https://gist.github.com/wtmujeebu/a941b8bff26a4239fe0b60d8de30d285)
   in your active theme’s functions.php.
 *  Thread Starter [lauratraveler](https://wordpress.org/support/users/lauratraveler/)
 * (@lauratraveler)
 * [5 years ago](https://wordpress.org/support/topic/async-defer-css/#post-14475708)
 * Thanks [@webtoffee](https://wordpress.org/support/users/webtoffee/). Unfortunately,
   adding this code to my child theme causes a bunch of issues with Cloudflare’s
   Rocket Loader 🙁
 *  Plugin Author [WebToffee](https://wordpress.org/support/users/webtoffee/)
 * (@webtoffee)
 * [5 years ago](https://wordpress.org/support/topic/async-defer-css/#post-14479761)
 * Hi [@lauratraveler](https://wordpress.org/support/users/lauratraveler/),
 * Kindly elaborate the issue that you are having while using the code and also 
   share the site URL.
 *  Thread Starter [lauratraveler](https://wordpress.org/support/users/lauratraveler/)
 * (@lauratraveler)
 * [5 years ago](https://wordpress.org/support/topic/async-defer-css/#post-14491185)
 * Hi [@webtoffee](https://wordpress.org/support/users/webtoffee/)
 * When using the code above in combination with Cloudflare + Rocket Loader on, 
   I get ‘Avoid document.write()’ for Rocket Loader, ‘Minimize main-thread work 
   warning’, and ‘Preload key requests’ for jQuery.
 * If I switch Rocket Loader off, the jQuery becomes render-blocking and ‘Avoid 
   chaining critical requests’ now includes a bunch of js files (including the cookie-
   law-info-public.js) while removing the cookie law info CSS files. Basically not
   a good trade-off.
 *  Plugin Author [WebToffee](https://wordpress.org/support/users/webtoffee/)
 * (@webtoffee)
 * [5 years ago](https://wordpress.org/support/topic/async-defer-css/#post-14539727)
 * Hi [@lauratraveler](https://wordpress.org/support/users/lauratraveler/),
 * Unfortunately, this is the solution we currently have in hand. We will be making
   improvements in the plugin as we go on.
 * We will add your requirement into backlogs and will consider it during further
   improvements.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Async/defer CSS’ is closed to new replies.

 * ![](https://ps.w.org/cookie-law-info/assets/icon.svg?rev=3007243)
 * [CookieYes – Cookie Banner for Cookie Consent (Easy to setup GDPR/CCPA Compliant Cookie Notice)](https://wordpress.org/plugins/cookie-law-info/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cookie-law-info/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cookie-law-info/)
 * [Active Topics](https://wordpress.org/support/plugin/cookie-law-info/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cookie-law-info/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cookie-law-info/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [WebToffee](https://wordpress.org/support/users/webtoffee/)
 * Last activity: [5 years ago](https://wordpress.org/support/topic/async-defer-css/#post-14539727)
 * Status: resolved