Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lordpuza/5a58ae9f71d2dce2c886 to your computer and use it in GitHub Desktop.
Save lordpuza/5a58ae9f71d2dce2c886 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/)
// 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. "&#xf166")
var unicode = $(element).children(".muted").text(); // 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")[3].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' + unicode); // Unicode Only
//awesomeOutput += ('\n' + className); // Classname Only
//awesomeOutput += ('\n' + properName); // Propername Only
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
@lordpuza
Copy link
Author

FA 4.4 in lazy paste
http://pastebin.com/hnuZTe08

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment