Skip to content

Instantly share code, notes, and snippets.

@zsherman
Created Aug 16, 2017
Embed
What would you like to do?
import Document, { Head, Main, NextScript } from 'next/document'
import { ServerStyleSheet } from 'styled-components'
import 'styles/global-styles';
export default class SiteDocument extends Document {
render () {
const sheet = new ServerStyleSheet()
const main = sheet.collectStyles(<Main />)
const styleTags = sheet.getStyleElement()
return (
<html>
<Head>
<meta charSet="utf-8" />
<meta name="viewport" content="initial-scale=1.0, width=device-width" />
{styleTags}
</Head>
<body>
<div className="root">
{main}
</div>
<NextScript />
</body>
</html>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment