Skip to content

Instantly share code, notes, and snippets.

@surajitbasak109
Last active November 21, 2020 16:39
Show Gist options
  • Save surajitbasak109/69b92aced915682db76239735a5238a9 to your computer and use it in GitHub Desktop.
Save surajitbasak109/69b92aced915682db76239735a5238a9 to your computer and use it in GitHub Desktop.
Download all font awesome icons as JSON format
/**
* Follow This link first:
* https://fontawesome.com/cheatsheet
* Then enter following code in console panel
* will show a download dialog to download as json format
* :) :) :)
*/
(function () {
let icons = document.querySelectorAll('.icon');
let data = Array.from(icons).map(icon => {
return {
name: icon.querySelector('.icon-name').textContent,
unicode: icon.querySelector('.icon-unicode').textContent,
};
});
const blob = new Blob([JSON.stringify(data, null, 2)], {type: 'application/json'});
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = "font-awesome-db";
document.body.appendChild(link);
link.click();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment