Created
November 22, 2018 06:47
-
-
Save woodnathan/07d39b12294afd7fec8f0028456caa38 to your computer and use it in GitHub Desktop.
Font Audit Utility
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
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; | |
}, {} ) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Useful as a bookmarklet