Static Sites & Deployment

Web Asset

Definition

Web assets are the files a browser fetches as a consequence of parsing a document, rather than because someone typed their address. A modest page has perhaps twenty of them: one or two stylesheets, a script bundle, a favicon, a handful of images and a web font in two weights. Each is a separate HTTP request with its own URL, status code and caching rules, and each one can fail on its own without taking the page down with it. Assets usually dominate the weight of a site — HTML is rarely more than a few tens of kilobytes, while images alone routinely run to several megabytes. Because they change less often than the markup, they are the part of a site worth caching hard and worth putting through asset bundling before publishing.

Why It Matters

A page is only finished when its assets arrive, so their number and size decide how the site actually feels. Swap one unoptimised 4 MB hero photograph for a 180 KB WebP and a phone on a slow connection stops waiting six seconds for the page to look right. The ordering matters too: a render-blocking stylesheet delays the first paint, while an image further down the page does not. Minification and compression trim the text assets, but the large win is nearly always the pictures. Assets are also where broken paths show themselves first — the HTML loads, and everything it depends on quietly 404s.

How It Works

The browser parses the HTML, and every link, script, img, video and preload element it meets queues another request. Each response carries a Content-Type that tells the browser what it received — text/css, application/javascript, image/webp, font/woff2 — and the browser refuses to use a file whose MIME type contradicts how it was referenced. Cache-Control and ETag headers on those responses decide whether the next visit fetches the file again or reuses the stored copy. Build tools typically stamp a content hash into asset filenames, such as app.9f3c21.css, so a file can be cached for a year and a new build simply asks for a different name. Fonts add one more rule: they are fetched cross-origin by default, so a missing CORS header quietly leaves the page in a fallback typeface.

Real-World Example

A recruiter publishes a one-page CV site on 99helpers at jo-lewis.99helpers.site: index.html at 12 KB, a stylesheet at 8 KB, a headshot, and a downloadable PDF. The headshot goes up as a 5.2 MB camera JPEG, which is 99 per cent of the page weight and takes four seconds to appear on a phone. Exported at 800 pixels wide it becomes 96 KB and the page is complete almost immediately. The PDF stays large, but it is only fetched when somebody clicks, so it costs nothing to the people who do not.

Common Mistakes

  • Uploading camera-resolution photographs — a 4000-pixel image displayed 600 pixels wide wastes the entire difference on every single visitor
  • Referencing assets with a leading slash while the site is served from a sub-folder — the markup renders and every stylesheet and image 404s
  • Serving a stylesheet with the wrong Content-Type — browsers refuse it outright, so the page arrives unstyled with no obvious error on screen

Related Terms

Put a file online in seconds

Drop in a document, an image, a page or a whole static website and share the link — free, with no build step and no server to set up.

Host a file free →