zachleat / speedlify

Benchmark the web performance and accessibility of sites over time.
https://www.speedlify.dev/
MIT License
919 stars 167 forks source link

Add Lighthouse & page weight sparklines #61

Closed delucis closed 1 year ago

delucis commented 1 year ago

This PR adds an SVG sparkline utility and {% lighthouseSparkline site %} and {% weightSparkline site %} shortcodes for showing small summaries of site data over time. I’ve added these to the main site overview:

Preview of new sparkline in Speedlify

I tweaked some of the breakpoints at which different stats get hidden to keep things working with these new elements. The importance of the different stats is a bit subjective, so I hope I prioritised things in an acceptable way.

The Lighthouse sparkline uses a colour scheme much like the speedlify score circles:

Sparkline showing transitions of colour between red for low values, orange for mid range, and green for high values

In my usage for Astro, I actually cropped this to the 360–400 range on the basis that any lower than that is too bad for variation to be interesting. Given the more generic usage here, I’ve left the Lighthouse sparkline showing 0–400. Easy enough to tweak in the shortcode function if you want to see variation in the upper range more clearly.

Let me know what you think and if you’d like any changes.