Measures text in a Web Worker before the browser paints — reserve its height to stop layout shift, shrink-wrap to content width, or style by line count. A Vite plugin; add one attribute.
npm i -D vite-pretext
// vite.config.ts
import { vitePretext } from 'vite-pretext';
export default { plugins: [vitePretext()] };
<p data-pretext>Long paragraph that reserves its height…</p>
Explore every mode →
Press Start streaming below. Same content both sides — only the left opts in. Watch the WITHOUT column's unexpected shift climb while the left holds steady.
Reading offsetHeight after a write forces synchronous layout. Reading the pretext-cached min-height doesn't. The benchmark runs both and reports the fps speedup.
preparing…
rAF-driven spinner — visibly stutters when the main thread blocks