Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions memory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ and link them below.
- [ci-and-verification.md](ci-and-verification.md) — how the site builds/deploys and how to verify changes (incl. the rtk/prettier gotcha)
- [csp-policy.md](csp-policy.md) — the meta-tag CSP: what it allows and why, and what can't be enforced this way
- [seo-and-metadata.md](seo-and-metadata.md) — SEO/metadata decisions (German-only, no JSON-LD, canonical/feed)
- [finding-unused-assets.md](finding-unused-assets.md) — how to check if an image/PDF/CSS class is really unused (and the srcset / URL-encoding traps)
25 changes: 25 additions & 0 deletions memory/finding-unused-assets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Finding unused assets (images, PDFs, CSS classes)

This is a Webflow export, so `assets/` carries a lot of dead scaffolding. When checking whether an asset is really unused, grep the **built `_site`** (the
ground truth of what ships), not just the source — and scan HTML **plus CSS plus `site.webmanifest`**, because references live in all three.

```bash
bundle exec jekyll build >/dev/null
grep -rhoE '[A-Za-z0-9._%ÖÄÜ+-]+\.(png|jpg|jpeg|svg|webp|gif)' _site \
--include='*.html' --include='*.css' --include='*.webmanifest' | sort -u
```

Two false-positive traps that made me nearly flag _used_ files as orphans:

- **`srcset` responsive variants.** Webflow images come as `foo.png` plus `foo-p-500.png` / `-p-800` / `-p-1080`. Pages reference the variants via `srcset`,
often NOT the full-size original. (Real case: the index hero uses only the `InOEG_IRIS-One-Pager_Hero-p-*` variants; the 2 MB full-size
`InOEG_IRIS-One-Pager_Hero.png` is never referenced and never ships. So the earlier "optimise the 2 MB hero" idea was moot — PurgeCSS/the build already never
emit it.)
- **URL-encoded filenames.** PDFs/images with spaces are linked with `%20` (e.g. `230829_inoeg_Halbzeit Ampel.pdf` →
`/documents/230829_inoeg_Halbzeit%20Ampel.pdf`). A plain `grep -F "Halbzeit Ampel.pdf"` misses the link. Cross-check by counting: `<pdf links in page>` vs
`<pdf files on disk>` — all 13 documents/ PDFs are in fact linked in `veroeffentlichungen.md`.

Also note: dead Webflow CSS (unused `w-icon-*`, `w-lightbox-*` rules and their embedded `data:` fonts/images) is stripped from production by PurgeCSS, so it
never reaches users even when left in the source `assets/css/`.

Decision on file (2026-07): the maintainer chose NOT to delete orphaned image files despite ~4 MB being unused. Don't propose asset deletion again unless asked.
Loading