Skip to content

Instantly share code, notes, and snippets.

View p410n3's full-sized avatar

Phillip L. p410n3

View GitHub Profile
@p410n3
p410n3 / criticalcss-bookmarklet-devtool-snippet.js
Created October 9, 2018 09:08 — 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(": ");