Skip to content

Instantly share code, notes, and snippets.

@petermekhaeil
Last active June 1, 2021 13:51
Show Gist options
  • Save petermekhaeil/f03702e4df759c0c3d303bde90975fa9 to your computer and use it in GitHub Desktop.
Save petermekhaeil/f03702e4df759c0c3d303bde90975fa9 to your computer and use it in GitHub Desktop.
var elems = document.getElementsByTagName('*');
var usages = {};
for (var i = 0; i < elems.length; i++) {
var elemStyles = document.defaultView.getComputedStyle(elems[i], null);
var font = elemStyles.getPropertyValue('font-family').split(',')[0];
var weight = elemStyles.getPropertyValue('font-weight');
var style = elemStyles.getPropertyValue('font-style');
var fontName = `${font} ${weight} ${style}`;
if ((fontName.indexOf('Sephora') !== -1) || (fontName.indexOf('avalon') !== -1)) {
usages[fontName] = (usages[fontName] || 0) + 1;
}
}
console.table(usages)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment