Format follows content and nothing else: SVG for anything drawn, AVIF or WebP for photographs, PNG only for transparency. Three rules, and most of the weight on most pages comes from breaking the second one.
Giulia is preparing the assets for a hotel booking site in Palermo. A listing page carries 24 thumbnails, a hero, an icon set and a map pin, and the page had been shipping at 2.6 MB.
The numbers on one photograph
The same 800 px photograph is 96 kB as JPEG, 62 as WebP and 41 as AVIF. Same picture, same visible quality at normal viewing size, three encoders of different ages.
Modular Type Scale & CSS Flex/Grid Motion Lab
Test harmonic typography ratios and live Flexbox/Grid layouts with 1-click CSS export.
Multiply it out and the argument stops being about kilobytes: 24 thumbnails is 2.3 MB in JPEG and under a megabyte in AVIF. That is the whole listing page's image weight, changed by one export setting, with no visual difference anybody has reported.
Then ship 1x and 2x, and let srcset choose. A browser given two candidates and a size picks correctly for the device and the connection, and 3x is rarely worth the bytes: the difference is invisible on almost every screen and it is a third file to build, store and cache.
Names a script can read
Name it component, variant, size, density. Card-thumb-400 at 2x is a name a build script can read: it says which component the file belongs to, which variant, how wide it is and what density it is for, and a pipeline can generate and verify the whole set from that pattern.
Predictable filenames
Four slots make an asset name readable by a build script
Unlike ad-hoc labels such as hero-final-2-new, structured names let pipelines generate and verify every size.
- 01Componentcard binds the file to its UI block
- 02Variantthumb distinguishes role from hero or detail
- 03Size400 declares width for script checks
- 04Density2x pairs cleanly with 1x in srcset
If a filename tells a story about an afternoon, no script can regenerate it.
A name like hero-final-2-new tells you about an afternoon. It cannot be validated, it cannot be regenerated, and the day somebody needs the same image at a third size there is nowhere to put it.
What should never have been an asset
Never export what CSS can draw. A gradient, a rounded corner, a shadow, a divider line, a chevron: all of them are one or two declarations, all of them scale, all of them change colour with the theme, and none of them costs a request.
Non-assets
Exporting decorative UI vs writing CSS declarations
Six exported gradients, corners, and dividers added 34 kB and broke in dark mode before moving to CSS.
Never export anything CSS can draw directly.
On this site six of the assets were a gradient, two corners and a divider. Together they were 34 kB and three of them were wrong in dark mode, because an exported image does not know what mode it is in.
How it is handed over
The handover is a folder with a manifest, not a zip in a message. The manifest lists every file, what it is for, its dimensions and where it came from, and it is what makes an asset set auditable six months later when somebody asks whether a file is still used.
One listing page
What ships, in the shape it ships in
Every name in here can be read by a script, and everything absent from it is absent on purpose.
assets/
- img/photographs only, two densities each, generated from one master by a build step
- card-thumb-400.avif41 kB, and the file 24 of them on a listing page are made from
- card-thumb-400@2x.avifthe second density, and the last one worth producing
- hero-1600.avifone master, with srcset choosing between it and three smaller siblings
- icons/one sprite rather than a folder, because 34 separate requests is not a delivery
- icons.svg34 symbols referenced by id, and the only drawn asset on the page
- manifest.jsonevery file, its purpose, its dimensions and the frame it came from
- not-here/the gradient, two corner treatments and a divider, all of which are CSS and were 34 kB
The last branch is not a folder. It is a list of what was removed, kept in the manifest, because the useful half of an asset audit is the record of what stopped being an asset.
A zip attached to a message is a set of files with no provenance. Two of them will be wrong, one will be missing, and nobody will be able to tell which version of the design each came from.
What to open
Squoosh compares encoders side by side in a browser, free and open source, and it replaces exporting at the design tool's default quality, which is a guess made by somebody who has never seen your images. Drag one photograph in, compare the three formats at the size it will be shown at, and the setting for the whole site is decided in ten minutes.
What to open
Browser encoder checks and responsive HTML attributes
Picking the right quality once in Squoosh and letting srcset pick widths stops shipping 1600 px files to 190 px slots.
- Squoosh side-by-side check
- srcset and sizes delivery
- Squoosh side-by-side checktests JPEG, WebP, and AVIF at display size in ten minutes instead of guessing default quality
- srcset and sizes deliverylets the browser choose by screen width, density, and connection rather than scaling oversized files in CSS
One tool locks the encoder setting; the other ships only the pixels the device needs.
The srcset and sizes attributes do the delivery, part of the language and free, and they replace shipping one image and scaling it in CSS, which sends a 1600 px file to a phone showing it at 190. The browser knows the screen, the density and sometimes the connection, and it makes a better choice than a build script can.
Where it stalls: done by hand at the end
Assets are exported in the last hour before a handover, by the designer, one at a time, from a menu of formats and quality sliders.
Where it stalls
Manual last-hour exports drift across forty separate decisions
Exporting one large master and letting a build script produce sizes and formats removes human variance for good.
- Design tool holds master artlargest clean source ready for output
- Forty manual exports at handoversliders vary between 80 and default, some scaled to frame, some stuck at 1x
- Build-step generationtakes one day to wire up and outputs every size, format, and density consistently
Replace repeated export discipline with a single automated build step.
An export done by hand is a decision made forty times, and it will be made differently on the fortieth. Some at 80, some at the default, some scaled to the frame and some to the artboard, two of them accidentally at 1x. The set that arrives is internally inconsistent in ways nobody can see until somebody measures the page.
The alternative is not more discipline, it is a build step: the design tool exports the largest version once, and a script produces every size, format and density from it. It costs a day and it removes the task permanently.
What it looks like when it goes wrong
The listing page shipped JPEGs at the design tool's default quality, which was 90, and 2.3 MB of thumbnails. The site's own measurements showed the page taking about eleven seconds on a phone in the centre of Palermo in August, which is a place with a lot of tourists and not much bandwidth. The booking team read the number as a hosting problem and moved to a larger server, which changed nothing, because the bytes were leaving the server perfectly quickly.
Failure sequence
Why buying a bigger server did not speed up an eleven-second page
The hosting server delivered bytes quickly; the trouble was sending 2.3 MB of quality-90 JPEGs over tourist mobile links.
- Eleven-second mobile load in Augustsite telemetry from Palermo city centre
- Upgrade to a larger hosting serverchanged nothing because server throughput was not the bottleneck
- Quality 90 default JPEGs2.3 MB of thumbnails per listing page
- Crowded tourist mobile networksslow bandwidth magnified oversized image payloads
Always check payload bytes before blaming server capacity.
What each of these files is for, and which states need which, comes out of the document beside them, which is sizes, states and behaviour written down. The icon set has a delivery format of its own and it is not a folder of files, which is a set that reads consistently at one size. And the build step that would remove this task is a conversation to have before the work starts, which is what to agree before the build starts. What else a handover owes is one level up, in everything a developer needs and usually is not given.