mirror of
https://github.com/filecoin-project/slate.git
synced 2024-12-25 18:13:10 +03:00
35 lines
760 B
JavaScript
35 lines
760 B
JavaScript
import Document, { Html, Head, Main, NextScript } from "next/document";
|
|
|
|
import { extractCritical } from "@emotion/server";
|
|
|
|
export default class MyDocument extends Document {
|
|
static async getInitialProps(ctx) {
|
|
const initialProps = await Document.getInitialProps(ctx);
|
|
const styles = extractCritical(initialProps.html);
|
|
return {
|
|
...initialProps,
|
|
styles: (
|
|
<>
|
|
{initialProps.styles}
|
|
<style
|
|
data-emotion-css={styles.ids.join(" ")}
|
|
dangerouslySetInnerHTML={{ __html: styles.css }}
|
|
/>
|
|
</>
|
|
),
|
|
};
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<Html>
|
|
<Head />
|
|
<body>
|
|
<Main />
|
|
<NextScript />
|
|
</body>
|
|
</Html>
|
|
);
|
|
}
|
|
}
|