Skip to main content
SebasVergaraP

Control engineer and full-stack WordPress developer.

Shipping less JavaScript than you think you need

1 minute read

Every performance conversation starts with a number that nobody measured. The useful version is smaller: what does one article page actually download, after gzip, with a cold cache?

Measure the page that pays

An article page is not the same as a landing page, and a bundle report is not the same as a network log. The build output tells you what you produced; only the network tells you what the reader downloaded.

measure.sh
# Cold cache, one route, gzipped transfer size.
curl -s -H 'Accept-Encoding: gzip' -o /dev/null \
  -w 'transfer: %{size_download} bytes\ntime:     %{time_total}s\n' \
  https://example.com/an-article/

What actually shipped

AssetRawGzippedBudget
Stylesheet12.7 KiB4.4 KiB25 KiB
JavaScript1.9 KiB1.0 KiB30 KiB
Fonts, cold cache69 KiB——
Two routes only: the article, with everything it needs.

The rules that kept it small

  • Enqueue per template, never globally. A 404 has no business loading article styles.
  • Prefer the platform. A <details> element costs nothing and needs no runtime.
  • Reach for a library only when the platform genuinely cannot do the job.
  • Put the number in a test, or it will drift.

None of this is clever. It is mostly a refusal to add things, which is harder to sustain than it sounds.

Part of a series

Part 2 of 3 in Building this theme

  1. A WP_Query that does not query twice
  2. Shipping less JavaScript than you think you need
  3. Why this theme has no cascade layers

About the author

Sebastian Vergara is a Control Engineer and Full-Stack & WordPress Developer with over 7 years of experience in full-stack web development. His expertise encompasses end-to-end website design and launch, custom web and mobile application development, server administration, web security, search engine optimization (SEO), and database control.

Leave a comment

Your email address will not be published. Required fields are marked.