-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHtml.js
40 lines (39 loc) · 1.21 KB
/
Html.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import * as React from "react";
import { renderStaticOptimized } from "glamor/server";
import Head from "react-helmet";
export default ({ App, render }) => {
const { html, Main, State, Script } = render(<App />);
const { css, ids } = renderStaticOptimized(() => html);
const helmet = Head.renderStatic();
return (
<html {...helmet.htmlAttributes.toComponent()}>
<head>
<meta charSet="utf-8" />
<meta httpEquiv="x-ua-compatible" content="ie=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<link href="/reset.css" rel="stylesheet" />
{helmet.meta.toComponent()}
{helmet.title.toComponent()}
{helmet.base.toComponent()}
{helmet.link.toComponent()}
{helmet.style.toComponent()}
{helmet.script.toComponent()}
{helmet.noscript.toComponent()}
<style dangerouslySetInnerHTML={{ __html: css }} />
</head>
<body>
<Main />
<State />
<script
dangerouslySetInnerHTML={{
__html: `window._glam = ${JSON.stringify(ids)}`,
}}
/>
<Script />
</body>
</html>
);
};