Files
2026-04-01 15:52:53 -07:00

63 lines
1.5 KiB
TypeScript

import Document, {
Head,
Html,
Main,
NextScript,
DocumentContext,
} from "next/document";
import { ServerStyleSheet } from "styled-components";
export default class MyDocument extends Document {
static async getInitialProps(ctx: DocumentContext) {
const initialProps = await Document.getInitialProps(ctx);
return initialProps;
}
// static async getInitialProps(ctx) {
// const sheet = new ServerStyleSheet();
// const originalRenderPage = ctx.renderPage;
// try {
// ctx.renderPage = () =>
// originalRenderPage({
// enhanceApp: (App) => (props) =>
// sheet.collectStyles(<App {...props} />),
// });
// const initialProps = await Document.getInitialProps(ctx);
// return {
// ...initialProps,
// styles: (
// <>
// {initialProps.styles}
// {sheet.getStyleElement()}
// </>
// ),
// };
// } finally {
// sheet.seal();
// }
// }
render() {
return (
<Html lang="en" dir="ltr">
<Head>
<link rel="shortcut icon" href="/img/egg.png" />
<link rel="manifest" href="/manifest.json" />
</Head>
<body>
<Main />
<NextScript />
</body>
<script src="https://cdn.babylonjs.com/babylon.js"></script>
<script src="https://cdn.babylonjs.com/loaders/babylonjs.loaders.min.js"></script>
<script src="a.js"></script>
</Html>
);
}
}