Created
August 28, 2014 20:00
-
-
Save harrisrobin/64c60119457d891ea6d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Usage: | |
// 1. Extract critical path CSS (see: http://addyosmani.com/blog/tag/critical-path-css) | |
// 2. Inline extracted styles within <head> | |
// 2. Place loader IIFE within <script> tags at end of <body> | |
(function(b,f){var c=[ | |
"styles/style1.css", | |
"styles/style2.css" | |
],a=function(){for(var g=0;g<c.length;g++){var d=f.createElement("link");d.rel="stylesheet"; | |
d.href=c[g];var j=f.getElementsByTagName("head")[0];j.parentNode.insertBefore(d,j)}}, | |
e=b.requestAnimationFrame||b.mozRequestAnimationFrame||b.webkitRequestAnimationFrame|| | |
b.msRequestAnimationFrame;if(e){e(a)}else{window.addEventListener("load",a)}})(window,document) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment