Created
July 14, 2020 20:10
-
-
Save tarecord/40d210e8180dd58f5fcd4ad75bbfd564 to your computer and use it in GitHub Desktop.
Find a list of font families within CSS, SCSS or SASS
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
// var content = document.querySelector('.my-css-file'); | |
content.match(/font-family:\s[\'|\"](.*)[\'|\"]/g).map(function(string){ | |
var font = string.split(": "); | |
return font[1].slice(1, -1); | |
}).filter((v, i, a) => a.indexOf(v) === i) | |
// returns reduced array of unique font families: ['Times New Roman', 'Source Sans Pro', ... ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment