Skip to content

Converts all PNG images in website/ to WebP format to reduce repository size and improve page load performance#934

Draft
VelmiraS wants to merge 1 commit intomasterfrom
chore/optimize-website-assets
Draft

Converts all PNG images in website/ to WebP format to reduce repository size and improve page load performance#934
VelmiraS wants to merge 1 commit intomasterfrom
chore/optimize-website-assets

Conversation

@VelmiraS
Copy link
Copy Markdown
Collaborator

What this PR does / why we need it:
Converts 252 PNG images in website/ to WebP format, reducing repository
size by ~100MB (~70%). Also adds two reusable scripts for future asset
optimization and updates all markdown/vue references accordingly.

JPG/JPEG photos are intentionally kept unchanged — re-compressing them
causes visible quality loss.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:
Some PNG files in the repository are photographs saved as PNG instead of JPG
(e.g. hackathon group pictures like 2025-07.png, 2025-06.png). After
converting to WebP at quality 85, these appear slightly washed out compared
to the originals.

Please advise on preferred approach:

  1. Accept current quality (still ~70% smaller)
  2. Increase quality to 90-92 (less savings)
  3. Exclude hackathon group pictures from conversion

- Convert 252 PNG files to WebP (quality 85)
- Keep JPG/JPEG photos unchanged (no re-compression quality loss)
- Update all .md/.vue references to use .webp
- Skip favicons and web manifest icons (must stay PNG)
- Add scripts/optimize-assets.mjs for future conversions
- Add scripts/update-asset-refs.mjs for updating references
@gardener-prow gardener-prow Bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Apr 14, 2026
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 14, 2026

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 14, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9f44e7de-9d6c-4062-8ef0-65fb43b4bb0e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/optimize-website-assets

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 14, 2026

Deploy Preview for gardener-docs failed.

Name Link
🔨 Latest commit 115439c
🔍 Latest deploy log https://app.netlify.com/projects/gardener-docs/deploys/69de346eddb1ff000883ee7d

@gardener-prow
Copy link
Copy Markdown

gardener-prow Bot commented Apr 14, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign dimitar-kostadinov for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@gardener-prow gardener-prow Bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. cla: no Indicates the PR's author has not signed the cla-assistant.io CLA. labels Apr 14, 2026
@BoHristova
Copy link
Copy Markdown
Contributor

Thank you!

Could you please follow the instructions for signing the Contributor License Agreement. You only have to do it once ;)

@BoHristova BoHristova added the kind/enhancement Enhancement, improvement, extension label Apr 14, 2026
@gardener-prow gardener-prow Bot added cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. and removed do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. cla: no Indicates the PR's author has not signed the cla-assistant.io CLA. labels Apr 14, 2026
Copy link
Copy Markdown
Member

@klocke-io klocke-io left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for pushing this topic,

Could we add a mini check on CI for PR`s that we do not allow assets over a reasonable size, maybe check what is recommended for this? 1MB is probably quite large.

Also, we should add this transformation to the build pipeline in Netlify after we pull the rest of the content through DocForge. We then need to use a different target, though.

Comment thread .docforge/config
@@ -0,0 +1,31 @@
manifest: https://github.com/gardener/documentation/blob/master/.docforge/hugo.yaml
destination: hugo
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this file is marked as new 👀

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, wow 😳 that change in tone is quite dramatic 😅 whereas in the image above, I feel like the change is not noticeable.

Maybe for the first step we just exclude them and covert them to jpg for the time being

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this file in particular is just unreasonably large. Maybe we can compress it to around 1 MB before converting it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the scripts, but I am not sure if we should tackle those two problems independently of each other, instead of going through the files, finding every reference and link, converting those images and then updating the reference. This obviously also has its edge cases, such as when an image is referenced in multiple files, etc.

But I think this could resolve the problem we are having with the preview deploy as well.

// Parse args
const DRY_RUN = !process.argv.includes('--write')
const dirArg = process.argv.find((a, i) => process.argv[i - 1] === '--dir')
const TARGET_DIR = join(ROOT, dirArg ?? 'website')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const TARGET_DIR = join(ROOT, dirArg ?? 'website')
const TARGET_DIR = join(ROOT, dirArg ?? 'website')Add a comment on line R23Add diff commentMarkdown input: edit mode selected.WritePreviewAdd a suggestionHeadingBoldItalicQuoteCodeLinkMore Formatting tools itemsSaved replies```suggestion
```Add FilesPaste, drop, or click to add filesCancelCommentStart a review
// Only convert PNG files — JPG/JPEG are photos that lose quality when re-compressed
const CONVERTIBLE = ['.png']
const SKIP_BELOW_KB = 5
// These files must stay as PNG — browsers require specific formats for them
const SKIP_FILENAMES = new Set([
'favicon.png',
'favicon-16x16.png',
'favicon-32x32.png',
'favicon-96x96.png',
'apple-touch-icon.png',
'web-app-manifest-192x192.png',
'web-app-manifest-512x512.png',
])

How about we extract those configurations to the make file and call the script/scripts from there, so that the scripts stay independent from our project 🤗

This would make it easier to package them and reuse them later.

@gardener-prow
Copy link
Copy Markdown

gardener-prow Bot commented Apr 16, 2026

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@gardener-prow gardener-prow Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/enhancement Enhancement, improvement, extension needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants