Skip to content

Instantly share code, notes, and snippets.

@michaelschofield
Created January 7, 2016 07:38
Show Gist options
  • Save michaelschofield/d88c552d1378992304b7 to your computer and use it in GitHub Desktop.
Save michaelschofield/d88c552d1378992304b7 to your computer and use it in GitHub Desktop.
<link rel='stylesheet' href='//www.example-library.org/critical-1.0.min.css' type='text/css' media='all' />
<script>
// loadCSS
!function(e){"use strict";e.loadCSS=function(t,n,r){var i,l=e.document,o=l.createElement("link");if(n)i=n;else{var a=(l.body||l.getElementsByTagName("head")[0]).childNodes;i=a[a.length-1]}var s=l.styleSheets;o.rel="stylesheet",o.href=t,o.media="only x",i.parentNode.insertBefore(o,n?i:i.nextSibling);var f=function(e){for(var t=o.href,n=s.length;n--;)if(s[n].href===t)return e();setTimeout(function(){f(e)})};return o.onloadcssdefined=f,f(function(){o.media=r||"all"}),o}}(this);
loadCSS( '//www.example-library.org/uncritical-1.0.min.css' );
</script>
<noscript>
<link rel="stylesheet" href="//www.example-library.org/uncritical-1.0.min.css">
</noscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment