Permalink
Newer
100644
126 lines (118 sloc)
4.11 KB
1
import React from 'react';
2
import Document, { Head, Main, NextScript } from 'next/document';
4
import getContext from 'docs/src/modules/styles/getContext';
5
import config from 'docs/src/config';
17
<meta
18
name="description"
19
content="React Components that Implement Google's Material Design."
20
/>
21
<meta charSet="utf-8" />
22
{/* Use minimum-scale=1 to enable GPU rasterization */}
23
<meta
24
name="viewport"
25
content={
26
'user-scalable=0, initial-scale=1, ' +
27
'minimum-scale=1, width=device-width, height=device-height'
28
}
29
/>
30
{/*
31
manifest.json provides metadata used when your web app is added to the
32
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
33
*/}
34
<link rel="manifest" href="/static/manifest.json" />
35
{/* PWA primary color */}
37
<link
38
rel="stylesheet"
39
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500"
40
/>
44
<meta name="twitter:site" content="@MaterialUI" />
45
<meta name="twitter:title" content="Material-UI" />
46
<meta
47
name="twitter:description"
48
content="React Components that Implement Google's Material Design."
50
<meta name="twitter:image" content="https://material-ui-next.com/static/brand.png" />
51
{/* Facebook */}
52
<meta property="og:type" content="website" />
53
<meta property="og:title" content="Material-UI" />
54
<meta
55
property="og:description"
56
content="React Components that Implement Google's Material Design."
57
/>
64
{/* Global Site Tag (gtag.js) - Google Analytics */}
65
<script async src={`https://www.googletagmanager.com/gtag/js?id=${config.google.id}`} />
66
<script
67
// eslint-disable-next-line react/no-danger
68
dangerouslySetInnerHTML={{
69
__html: `
70
window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments)};
71
gtag('js', new Date());
72
`,
73
}}
74
/>
77
</body>
78
</html>
79
);
80
}
81
}
82
83
MyDocument.getInitialProps = ctx => {
84
// Resolution order
85
//
86
// On the server:
87
// 1. page.getInitialProps
88
// 2. document.getInitialProps
89
// 3. page.render
90
// 4. document.render
91
//
92
// On the server with error:
93
// 2. document.getInitialProps
94
// 3. page.render
95
// 4. document.render
96
//
97
// On the client
98
// 1. page.getInitialProps
99
// 3. page.render
100
106
107
let css = context.sheetsRegistry.toString();
108
if (process.env.NODE_ENV === 'production') {
109
css = cleanCSS.minify(css).styles;
110
}
111
116
styles: (
117
<style
118
id="jss-server-side"
119
// eslint-disable-next-line react/no-danger