import NextDocument, {Html, Head, Main, NextScript, DocumentContext} from 'next/document'; import { extractCss } from '@tesseract-design/goofy-goober'; export default class Document extends NextDocument { static async getInitialProps(ctx: DocumentContext) { const page = await ctx.renderPage() const style = extractCss(); const initialProps = await NextDocument.getInitialProps(ctx) return { ...initialProps, ...page, style, } } render() { const { style: rawStyle } = this.props as Record const style = rawStyle as string return ( { style.length > 0 && (