Skip to content

Instantly share code, notes, and snippets.

@woodnathan
Created November 22, 2018 06:47
Show Gist options
  • Save woodnathan/07d39b12294afd7fec8f0028456caa38 to your computer and use it in GitHub Desktop.
Save woodnathan/07d39b12294afd7fec8f0028456caa38 to your computer and use it in GitHub Desktop.
Font Audit Utility
console.log( 'FontAudit', Array.from( document.querySelectorAll( '*' ) ).flatMap( function ( el ) {
return [ [ el, getComputedStyle( el ) ], [ el, getComputedStyle( el, ':before' ) ], [ el, getComputedStyle( el, ':after' ) ] ];
} ).reduce( function ( fs, cst ) {
var el = cst[ 0 ];
var cs = cst[ 1 ];
var ff = cs[ 'font-family' ];
var fw = cs[ 'font-weight' ];
fs[ ff ] = fs[ ff ] || {};
fs[ ff ][ fw ] = fs[ ff ][ fw ] || new Set();
fs[ ff ][ fw ].add( el );
return fs;
}, {} ) );
@woodnathan
Copy link
Author

Useful as a bookmarklet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment