Permalink
Newer
100644
138 lines (130 sloc)
4.72 KB
1
import React from 'react';
2
import Document, { Head, Main, NextScript } from 'next/document';
3
import postcss from 'postcss';
4
import autoprefixer from 'autoprefixer';
5
import cssnano from 'cssnano';
9
// You can find a benchmark of the available CSS minifiers under
10
// https://github.com/GoalSmashers/css-minification-benchmark
11
// We have found that clean-css is faster than cssnano but the output is larger.
12
// Waiting for https://github.com/cssinjs/jss/issues/279
13
// 4% slower but 12% smaller output than doing it in a single step.
26
<meta
27
name="description"
28
content="React Components that Implement Google's Material Design."
29
/>
30
{/* Use minimum-scale=1 to enable GPU rasterization */}
31
<meta
32
name="viewport"
33
content={
34
'user-scalable=0, initial-scale=1, ' +
35
'minimum-scale=1, width=device-width, height=device-height'
36
}
37
/>
38
{/*
39
manifest.json provides metadata used when your web app is added to the
40
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
41
*/}
42
<link rel="manifest" href="/static/manifest.json" />
43
{/* PWA primary color */}
45
<link
46
rel="stylesheet"
47
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500"
48
/>
52
<meta name="twitter:site" content="@MaterialUI" />
53
<meta name="twitter:title" content="Material-UI" />
54
<meta
55
name="twitter:description"
56
content="React Components that Implement Google's Material Design."
58
<meta name="twitter:image" content="https://material-ui-next.com/static/brand.png" />
59
{/* Facebook */}
60
<meta property="og:type" content="website" />
61
<meta property="og:title" content="Material-UI" />
62
<meta
63
property="og:description"
64
content="React Components that Implement Google's Material Design."
65
/>
73
{/* Global Site Tag (gtag.js) - Google Analytics */}
74
<script async src={`https://www.googletagmanager.com/gtag/js?id=${config.google.id}`} />
75
<script
76
// eslint-disable-next-line react/no-danger
77
dangerouslySetInnerHTML={{
78
__html: `
79
window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments)};
80
gtag('js', new Date());
81
`,
82
}}
83
/>
93
// Resolution order
94
//
95
// On the server:
96
// 1. page.getInitialProps
97
// 2. document.getInitialProps
98
// 3. page.render
99
// 4. document.render
100
//
101
// On the server with error:
102
// 2. document.getInitialProps
103
// 3. page.render
104
// 4. document.render
105
//
106
// On the client
107
// 1. page.getInitialProps
108
// 3. page.render
109
110
// Get the context of the page to collected side effects.
111
const pageContext = getPageContext();
128
styles: (
129
<style
130
id="jss-server-side"
131
// eslint-disable-next-line react/no-danger