I'm working on my site speed score and trying to improve my Pagespeed (Remove unused CSS report).
First I have followed this page: load CSS simpler and I have deferred the following way but page speed keeps alerting me that the /css/second-style CSS file is not deferred:
<link rel="stylesheet" href="/css/second-style.css" media="print" onload="this.media='all'">
So, I have tried another way, using: loadCSS, I have done it this way:
<script src="loadCSS.js"></script>
<script>
loadCSS( "/css/second-style.css" );
</script>
I think the two ways of doing it are quite clear and simple, and they are supposed to work but page speed does not approve /css/second-style.css.
Any idea if in 2021 it has to be done differently or what is my mistake? Is there another way to delay the CSS load?