Created
June 4, 2018 10:44
-
-
Save Thiruppathi/b0a267f27d782572c1f385d07cb4f8db to your computer and use it in GitHub Desktop.
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
/* | |
[](https://github.com/ebidel/lighthouse-badge) | |
[](https://github.com/ebidel/lighthouse-badge) | |
[](https://github.com/ebidel/lighthouse-badge) | |
[](https://github.com/ebidel/lighthouse-badge) | |
[](https://github.com/ebidel/lighthouse-badge) | |
*/ | |
// let compactTemplate = `[]`; | |
let myScores = { | |
Performance: 98, | |
PWA: 100, | |
A11y: 90, | |
BestPractices: 94, | |
SEO: 89 | |
}; | |
let projectUrl = "https://github.com/thiruppathi/lighthouse-badge"; | |
generateMdBadge = (category = "", score, size = "") => { | |
return `[](${projectUrl})`; | |
}; | |
generateHtmlBadge = (category = "", score, size = "") => { | |
return `<a href="${projectUrl}" target="_blank"> | |
<img src="https://lighthouse-badge.appspot.com?${score}&${size}&category=${category}"> | |
</a>`; | |
}; | |
generateBadges = myScores => { | |
Object.entries(myScores).forEach(([key, value]) => { | |
console.log(generateMdBadge(key, value, "compact")); | |
console.log(generateHtmlBadge(key, value, "compact").toString()); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment