|
1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- 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<string, unknown>
- const style = rawStyle as string
-
- return (
- <Html>
- <Head>
- {
- style.length > 0
- && (
- <style
- id="_goober"
- dangerouslySetInnerHTML={{ __html: style }}
- />
- )
- }
- </Head>
- <body>
- <Main />
- <NextScript />
- </body>
- </Html>
- )
- }
- }
|