Hi Jan,
Great. No error in IE8.
I am still figuring why you have two options for loading CSS async, but won’t be hard to figure.
On the issue of W3TC minification turned on, I still see it loading the CSS on top (render-blocking) with with the theme CSS files loading async. .
I have figured how to make W3TC load CSS async. This can be done by keep CSS minification on in manual mode and then modifying the file
wp-content/plugins/w3-total-cache/lib/W3/Plugin/Minify.php
with (original code commented):
/* return "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . str_replace('&', '&', $url) . "\" media=\"all\" />\r\n"; */
return <<<EOT
<script id="loadcss">
function loadCSS(e,n,o,t){"use strict";var d=window.document.createElement("link"),i=n||window.document.getElementsByTagName("script")[0],r=window.document.styleSheets;return d.rel="stylesheet",d.href=e,d.media="only x",t&&(d.onload=t),i.parentNode.insertBefore(d,i),d.onloadcssdefined=function(e){for(var n,o=0;o<r.length;o++)r[o].href&&r[o].href===d.href&&(n=!0);n?e():setTimeout(function(){d.onloadcssdefined(e)})},d.onloadcssdefined(function(){d.media=o||"all"}),d}
</script>
<script>
loadCSS( "$url", document.getElementById("loadcss") )
</script>
EOT;
This is without using your plugin. However it is risky, so handling it with your plugin is much better. Just throwing some ideas. IMO, using your plugin +W3TC should be enough. Just that I can’t seem to use the W3TC minify output with your plugin in the current production.
Thanks. Wonderful plugin.