2016-12-23 19:18:25 +00:00
|
|
|
import Document, { Head, Main, NextScript } from 'next/document'
|
|
|
|
import { renderStatic } from 'glamor/server'
|
|
|
|
|
|
|
|
export default class MyDocument extends Document {
|
|
|
|
static async getInitialProps ({ renderPage }) {
|
|
|
|
const page = renderPage()
|
2017-02-26 12:28:00 +00:00
|
|
|
const styles = renderStatic(() => page.html)
|
2016-12-23 19:18:25 +00:00
|
|
|
return { ...page, ...styles }
|
|
|
|
}
|
|
|
|
|
2017-02-26 12:28:00 +00:00
|
|
|
constructor (props) {
|
|
|
|
super(props)
|
|
|
|
const { __NEXT_DATA__, ids } = props
|
|
|
|
if (ids) {
|
|
|
|
__NEXT_DATA__.ids = this.props.ids
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-23 19:18:25 +00:00
|
|
|
render () {
|
|
|
|
return (
|
|
|
|
<html>
|
|
|
|
<Head>
|
|
|
|
<title>My page</title>
|
|
|
|
<style dangerouslySetInnerHTML={{ __html: this.props.css }} />
|
|
|
|
</Head>
|
|
|
|
<body>
|
|
|
|
<Main />
|
|
|
|
<NextScript />
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|