Skip to content

Serve the site's fixed logos through NgOptimizedImage - #420

Merged
adamjohnwright merged 1 commit into
mainfrom
perf/338-optimized-logos
Oct 12, 2026
Merged

adamjohnwright merged 1 commit into
mainfrom
perf/338-optimized-logos

Conversation

@adamjohnwright

@adamjohnwright adamjohnwright commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Part of #338: the "static logos" step its plan starts with.

  • ngSrc with intrinsic width/height on the navigation-bar logo (light and dark), the home-page logo, the four sponsor logos and the three related-project logos. The sizes were read from the files.
  • The header logo is marked priority: it's the likely LCP element on every page, so it gets fetched eagerly with high priority. Both variants are marked, because which one shows depends on the theme.
  • The home page's lower logos now load lazily, the directive's default.

A layout trap, measured

The sponsor logos were sized by max-width: 80px; max-height: 50px alone. With the width/height attributes that ngSrc requires, the browser stretched every one to 80×50. .sponsor-logo now also sets width: auto; height: auto, so the attributes only give the browser each logo's shape early.

How it was checked: every logo's rendered box was recorded on beta (main) and on this branch, served locally, at 1400px and 390px wide in light and dark:

  • with the CSS fix: 36 of 36 identical, all loaded;
  • without it: 16 differ, all sponsor logos at 80×50.

Review notes

  • Development builds now warn (NG02960) about four oversized images. The 2126px header logo is drawn at about 215×45 on every page, plus the home logo and the NYU and OHSU sponsor logos. These are warnings, not errors; production builds don't check. They're a fair hint: smaller copies of those files (2× their drawn size) would save most of each download. That's an asset change for a follow-up.
  • Both header logos are priority, so the hidden theme's copy (about 37KB) is fetched at high priority. It was always fetched, eagerly, before; which copy shows isn't known until the theme is.
  • No SSR or prerender, so priority adds no <link rel=preload>. The default loader leaves src as the same relative assets/… path, so nothing changes under /curatorgraph/ either.

Left for the rest of #338

The images whose size isn't known in advance (pathway figures, the diagram thumbnail, EHLD legend items, partner logos, article images, icons) need the per-image fill-in-a-sized-container decision #338 describes. prefer-ngsrc stays off until then.

Tests

  • Build and types: npm run build and check:types pass.
  • e2e: homepage, home-stats, content-pages and back-button: 45 passed. The fixture fails on any Angular dev-mode error.
  • Gates: check:lint and check:dead unchanged at their baselines.

🤖 Generated with Claude Code

The first part of #338: the navigation-bar logo (light and dark), the
home-page logo, and the sponsor and related-project logos use ngSrc with
their intrinsic width and height. The header logo, the likely LCP element on
every page, is marked priority; the home page's logos below the fold load
lazily, which is the directive's default.

The sponsor logos were sized by max-width and max-height alone; with the
width and height attributes that ngSrc needs, the browser stretched every
one to 80x50. They now also say width: auto and height: auto, so the
attributes only give the browser their shape early.

Measured on beta and on this branch, every logo's rendered box at 1400px
and 390px, light and dark: 36 of 36 identical, all loaded. Without the
sponsor CSS, 16 differ.

Part of #338.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adamjohnwright
adamjohnwright merged commit 9f8046c into main Oct 12, 2026
6 checks passed
@adamjohnwright
adamjohnwright deleted the perf/338-optimized-logos branch October 12, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant