I'm trying to defer a CSS file through default_head_blocks.xml.

After reading through as much as possible on here - and across the internet - I came across an answer suggesting to add defer="defer". This appears to have worked well on my JS files, but not on CSS. Many of the responses to that solution also stated that they had issues. Could anyone here please help me understand the best way of going about deferring CSS through layout (default_head_blocks.css)? This is for a non-essential chat plugin we're using for customer service, which doesn't need to render right away.

Thank you!

  • I suggest you check your resources again, defer doesn't apply for CSS. You can start researching with critical css magento keyword
    – Jimmy
    Apr 2, 2021 at 2:06
  • Thanks for the suggestion, I'll start looking into this. Sounds like the post I'm referring to was a little unclear on the original question which is why other people ran into the same error. I'll keep my post updated as I work it out for anyone else with the same issue. Apr 2, 2021 at 19:33


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.