Only include Font-Awesome if needed, deleted unused assets

This commit is contained in:
Alicia Sykes
2021-04-05 14:22:59 +01:00
parent 7f33be8485
commit d365be1394
1660 changed files with 16 additions and 1616 deletions

View File

@@ -94,11 +94,23 @@ export default {
getLayoutOrientation() {
return localStorage.layoutOrientation || 'default';
},
/* Injects font-awesome's script tag, used for item icons */
/* Checks if any of the icons are Font Awesome glyphs */
checkIfFontAwesomeNeeded() {
let isFound = false;
this.sections.forEach((section) => {
section.items.forEach((item) => {
if (item.icon && item.icon.includes('fas')) isFound = true;
});
});
return isFound;
},
/* Injects font-awesome's script tag, only if needed */
initiateFontAwesome() {
const fontAwesomeScript = document.createElement('script');
fontAwesomeScript.setAttribute('src', 'https://kit.fontawesome.com/def7c3ce4c.js');
document.head.appendChild(fontAwesomeScript);
if (this.checkIfFontAwesomeNeeded()) {
const fontAwesomeScript = document.createElement('script');
fontAwesomeScript.setAttribute('src', 'https://kit.fontawesome.com/def7c3ce4c.js');
document.head.appendChild(fontAwesomeScript);
}
},
},
mounted() {