Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Easiest and most natural way to load CSS asynchronously without blocking HTML rendering! Tested on and other projects by DUzun.ME
<!-- The <script> switches rel="prefetch" to rel="stylesheet" at proper time, et voila, magic happens :-) -->
<link rel="prefetch" type="text/css" href="" />
<link rel="stylesheet" type="text/css" href="" />
<link rel="stylesheet" type="text/css" href="" />
<link rel="prefetch" type="text/css" href="" />
function(f){var e='load',n,h=w[n='addEventListener']||w[n='attachEvent']&&(e='on'+e);h?w[n](e,f):setTimeout(f,17)})
for(var h=d.getElementsByTagName('link'),i=h&&h.length,l,c;0<i--;)
Load CSS in a non-blocking fashion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment