I generate a static site from a build script: a few hundred pages, one template, per-page text, and one inline <style> block in every <head> . That last part is a caching decision I never consciously made. I just never removed the block.
Last week I ran three measurements on the output directory: how much of the CSS is duplicated, how much of each block is unreferenced on the page that ships it, and what a multi-page visit actually transfers. Only the third one changed my mind. The first two are the reason I could not see the problem.
1. The duplication factor
The audit is about thirty lines. Walk the HTML files, pull out every <style> block, hash it, group pages by hash, then divide total CSS bytes by the bytes of one page per group.
const blocks = new Map ( ) ; for ( const f of files ) { const html = fs . readFileSync ( f , 'utf8' ) ; const css = [ . . . html . matchAll ( /< style [ ^> ] *> ( [ \ s \ S ] *? ) < \ / style >/ gi ) ] . map ( m => m [ 1 ] ) . join ( '\n' ) ; const key = sha256 ( css ) .β¦