Created
August 28, 2020 12:48
-
-
Save contactjavas/8ab3a5f66d2432f62385bd90db7ed11c to your computer and use it in GitHub Desktop.
Get Font Awesome 5 Unicodes
This file contains hidden or 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
/** | |
* Font Awesome Free | |
* | |
* https://fontawesome.com/cheatsheet/free/solid | |
* https://fontawesome.com/cheatsheet/free/regular | |
* https://fontawesome.com/cheatsheet/free/brands | |
* | |
* Visit pages above, paste this code to the console and enter. | |
* Copy the result and beautify it in https://codebeautify.org/jsonviewer | |
*/ | |
(function () { | |
var icons = {}; | |
const sets = document.querySelectorAll("section.cheatsheet-set"); | |
sets.forEach((set) => { | |
let prefix = ""; | |
switch (set.id) { | |
case "regular": | |
prefix = "far"; | |
break; | |
case "solid": | |
prefix = "fas"; | |
break; | |
case "light": | |
prefix = "fal"; | |
break; | |
case "brands": | |
prefix = "fab"; | |
break; | |
} | |
const articles = set.querySelectorAll("article.icon"); | |
articles.forEach((article) => { | |
const iconClass = prefix + " fa-" + article.id; | |
let unicode = article.querySelector("dd.icon-unicode").innerHTML; | |
unicode = "\\" + unicode; | |
icons[iconClass] = unicode; | |
}); | |
}); | |
return JSON.stringify(icons); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment