perf: convert theme screenshots to lossless WebP - #273
Merged
Conversation
The 11 theme screenshots in the Themes table were 304 KB of PNG. As lossless WebP they are 88 KB, a 71% cut with pixel-identical output. Lossless, not lossy: these are UI screenshots containing text, and for flat-colour images like these lossless WebP is actually smaller than lossy (4240 vs 4884 bytes at -q 82 for themes-dark), so there was no quality tradeoff to make. No <picture> fallback: WebP has been supported everywhere since Safari 14 in 2020. Only the theme screenshots are converted. The sponsor logos and plus.png are hotlinked by the main sweetalert2 repo's README, so renaming those would break it. Theme screenshots are site-local and regenerated from the sweetalert2 sandbox, per the comment in Themes.tsx. Part of #258 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Member
Author
|
Correction to the closing note in this PR: the I wrote that two committed
The reason is that There is no hygiene fix needed here. A repo-level My apologies for the noise; the WebP change itself is unaffected. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #258 — the WebP item, scoped to the images that can safely be converted.
Result
The 11 theme screenshots in the Themes table: 304 KB → 88 KB, a 71% cut, with pixel-identical output.
Lossless, not lossy
These are UI screenshots containing text, so I expected a quality tradeoff. There isn't one — for flat-colour images like these, lossless WebP is smaller than lossy:
So the text in every screenshot stays exactly as crisp as before. Verified dimensions are preserved (900×430 in, 900×430 out), which also means the
width/heightattributes added in #268 remain correct.No
<picture>fallback: WebP has been supported everywhere since Safari 14 / iOS 14 in 2020.Why only the theme screenshots
The sponsor logos (488 KB, the larger pile) and
plus.pngare hotlinked by the main sweetalert2 repo's README — I checked, and it referencessweetalert2.github.io/images/plus.pngandsweetalert2.github.io/images/sponsors/…. Renaming those files would break someone else's README, so they're deliberately untouched. The theme screenshots are site-local and regenerated from the sweetalert2 sandbox (per the comment at the top ofThemes.tsx), with zero external references.Verification
.webpfiles exist; 0 remaining.pngreferences inThemes.tsx, and no other file in the repo referenced them..webpand 0themes-*.pngtodist/images/.themes-dark.webp, and thewidth={300} height={143}attributes are intact.bun run lintandbun run buildpass.Two findings that stop the rest of #258
Deleting unreferenced images wouldn't help any metric. I audited all 78 files in
public/images/and found 16 unreferenced ones (171 KB) — but nothing requests them, so they cost zero page weight and zero CWV. It's repo housekeeping, not SEO. Worse, "unreferenced here" isn't "unused": the README hotlinking above proves external references exist, andsweetalert2.gif(84 KB) looks like exactly that kind of asset. I've left them alone.Two of those 16 are committed
.DS_Storefiles (16 KB) that get deployed to the live site —/images/.DS_Storewould be publicly fetchable. That's worth fixing as hygiene, but it's not SEO and doesn't belong in this PR.🤖 Generated with Claude Code