Developer Fixes Layout Shift and Analytics Issues in Browser-Based Image Compressor
A developer in Bangladesh built Compressify, a batch image compression tool that runs entirely in the browser using WebAssembly, avoiding server uploads of users' photos. Despite a perfect mobile score, PageSpeed Insights reported a desktop Cumulative Layout Shift of 0.676, caused by a font-display: optional font swap that reflowed the headline. The developer first tried metric-matched fallback fonts, which reduced but did not eliminate the shift, before embedding the critical font as a base64 data URI, bringing CLS to zero at the cost of a roughly 100 KB heavier HTML file. To cut unused JavaScript flagged by Lighthouse, the analytics and service worker scripts were moved to load only on the user's first interaction. The developer also described a silent Google Analytics bug where gtag rest-parameter syntax pushed arrays that the library ignored, requiring an arguments object instead.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in