2020-04-09 00:29:13 +03:00
|
|
|
import Document, { Head, Main, NextScript } from "next/document";
|
|
|
|
import { extractCritical } from "@emotion/server";
|
2020-02-19 09:30:47 +03:00
|
|
|
|
|
|
|
export default class MyDocument extends Document {
|
|
|
|
static getInitialProps({ renderPage }) {
|
|
|
|
const page = renderPage();
|
|
|
|
const styles = extractCritical(page.html);
|
|
|
|
return { ...page, ...styles };
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2020-04-09 00:29:13 +03:00
|
|
|
const ids = this.props.ids.join(" ");
|
|
|
|
|
2020-02-19 09:30:47 +03:00
|
|
|
return (
|
|
|
|
<html>
|
|
|
|
<Head>
|
2020-04-09 00:29:13 +03:00
|
|
|
<style
|
|
|
|
data-emotion-css={ids}
|
|
|
|
dangerouslySetInnerHTML={{ __html: this.props.css }}
|
|
|
|
/>
|
2020-02-19 09:30:47 +03:00
|
|
|
</Head>
|
|
|
|
<body>
|
|
|
|
<Main />
|
|
|
|
<NextScript />
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|