Last active
September 10, 2015 11:08
-
-
Save jspinella/7fe0a4a1be5cfea76400 to your computer and use it in GitHub Desktop.
Provides entire Font Awesome Cheatsheet in CSV format - just paste into your browser's Js console while on the Font Awesome Cheatsheet page (http://fortawesome.github.io/Font-Awesome/cheatsheet/)
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
// Font Awesome Cheatsheet to CSV | |
var awesomeOutput = ""; | |
$(".col-md-4.col-sm-6.col-lg-3").each(function (i, element) { // selects a Font Awesome cheatsheet item | |
// Unicode value (i.e. "") | |
var unicode = $(element).children(".muted").text().substring(1,8); // the unicode value is in a child span element with class "muted", this grabs it and "removes" the surrounding [brackets] | |
// CSS class name (i.e. "fa-youtube-square") | |
var className = $(element).text().split("\n")[2].trim(); // takes all text items in element (the FA icon, class name, and unicode value), selects the class name, and trims the extra space | |
// Proper name (i.e. "Youtube square") | |
properName = className.replace("fa-", "").replace(/-/g, " "); // since class name is almost the same as the name, this removes the "fa-" prefix and replaces all hyphens with spaces | |
properName = properName.charAt(0).toUpperCase() + properName.substr(1) // capitalizes the first letter of the first word in the name | |
// Output format | |
awesomeOutput += ('\n' + properName + "," + className + "," + unicode); // formats for CSV; easily change the order to your preference | |
}); | |
console.log(awesomeOutput); // output awesomeOutput to console for easy CopyPasta-ing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
FA 4.4 in lazy paste
http://pastebin.com/hnuZTe08