import { createHtmlTransformer } from '#lib/html-utils/html-transformer' /** * HTML transformer that injects theme initialization script * This must run AFTER inject-polen-data transformer since it depends on window.__POLEN__ */ export const createThemeInitInjector = () => { return createHtmlTransformer((html, ___ctx) => { // Theme initialization script that runs immediately to prevent FOUC const themeInitScript = ` ` // Inject the script right after the Polen data script // This ensures __POLEN__ is available when this script runs return html.replace('', `${themeInitScript}\n`) }) }