Skip to content

Instantly share code, notes, and snippets.

View ryanc-me's full-sized avatar

Ryan Cole ryanc-me

View GitHub Profile
@ryanc-me
ryanc-me / criticalcss-bookmarklet-devtool-snippet.js
Created November 2, 2016 07:22 — forked from PaulKinlan/criticalcss-bookmarklet-devtool-snippet.js
CriticalCSS Bookmarklet and Devtool Snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");