// Derive editor body styles from the mockup CSS so the preview cannot drift. import { readFileSync, writeFileSync } from 'node:fs'; const css = readFileSync(new URL('../src/styles/global.css', import.meta.url), 'utf8'); const base = css.slice(0, css.indexOf('/* Utilities')); const prose = css.slice(css.indexOf('/* Prose'), css.indexOf('/* Footer')); const markdown = css.slice(css.indexOf('.prose { overflow-wrap:'), css.indexOf('.submenu a[aria-current="page"]')); const preview = (base + prose + markdown).replace(/\.prose\b/g, 'body'); writeFileSync(new URL('../public/admin/preview.css', import.meta.url), '/* Generated by scripts/preview-styles.mjs; edit src/styles/global.css. */\n' + preview + ` body { display: block; min-height: 0; max-width: 64rem; margin: 0 auto; padding: 1.5rem; } h1 { color: var(--galaxy-blue); font-family: var(--font-head); font-weight: 500; line-height: 1.05; } `);