mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-26 13:45:30 +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>
|
|
);
|
|
}
|
|
}
|