Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preventative measure to provide unrounded numbers from displaying. Fi… #239

Merged
merged 1 commit into from
Dec 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -211,6 +211,10 @@ module.exports = function (eleventyConfig) {
return readabilityScore;
})

eleventyConfig.addFilter('roundNumber', (value) => {
return Math.round(parseFloat(value));
})

eleventyConfig.addFilter('getScoreColor', (value) => {
if(parseInt(value) > 89) {
return 'speedlify-score-good';
4 changes: 2 additions & 2 deletions pages/_includes/par-scores.njk
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
{% if performance[page.url].lighthouse.performance %}
<span class="page-score-details">
<span class="page-score-block p-a-2">
<span class="speedlify-score {{(performance[page.url].lighthouse.performance * 100) | getScoreColor }}">{{performance[page.url].lighthouse.performance * 100}}</span>
<span class="speedlify-score {{(performance[page.url].lighthouse.performance * 100) | getScoreColor }}">{{(performance[page.url].lighthouse.performance * 100) | roundNumber }}</span>
<span>Performance</span>
</span>
<a href="/page-score-info/#performance">Why is performance important</a>
@@ -14,7 +14,7 @@
{% if performance[page.url].lighthouse.accessibility %}
<span class="page-score-details">
<span class="page-score-block p-a-2">
<span class="speedlify-score {{ (performance[page.url].lighthouse.accessibility * 100) | getScoreColor }}">{{performance[page.url].lighthouse.accessibility * 100}}</span>
<span class="speedlify-score {{ (performance[page.url].lighthouse.accessibility * 100) | getScoreColor }}">{{(performance[page.url].lighthouse.accessibility * 100) | roundNumber }}</span>
<span>Accessibility</span>
</span>
<a href="/page-score-info/#accessibility">Why is accessibility important</a>