-
Notifications
You must be signed in to change notification settings - Fork 1
/
gatsby-ssr.js
106 lines (101 loc) · 2.58 KB
/
gatsby-ssr.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*--------------------------------------------------------*\
| ██████ ██ |
| ██ ██ ██ |
| ██ ██ ██ |
| ██████ ██ | binary : tech art
|
| Gatsby static rendering configuraiton.
|----------------------------------------------------------
| Copyright(C) 2021 Valeriy Novytskyy
\*---------------------------------------------------------*/
import React from 'react';
import Layout from './src/components/Layout/Layout';
import UserContentProvider from './src/providers/UserContentProvider';
import { lightTheme as theme } from './src/theme';
export const wrapPageElement = ({
element,
props
}) => (
<Layout {...props}>
{element}
</Layout>
);
export const wrapRootElement = ({ element }) => (
<UserContentProvider>
{element}
</UserContentProvider>
);
export const onRenderBody = ({
setHtmlAttributes,
setPostBodyComponents
}) => {
const style = Object
.keys(theme)
.reduce((cssProperties, key) => {
cssProperties[`--${key}`] = theme[key]
return cssProperties;
}, {});
setHtmlAttributes({ style });
setPostBodyComponents([
<script
key="forceWWWW"
type="text/javascript"
src="/redirectToWWW.js"
></script>,
<script
key="axios"
type="text/javascript"
src="/lib/axios/dist/axios.standalone.js"
></script>,
<script
key="hmac-sha256"
type="text/javascript"
src="/lib/CryptoJS/rollups/hmac-sha256.js"
></script>,
<script
key="sha256"
type="text/javascript"
src="/lib/CryptoJS/rollups/sha256.js"
></script>,
<script
key="hmac"
type="text/javascript"
src="/lib/CryptoJS/components/hmac.js"
></script>,
<script
key="enc-base64"
type="text/javascript"
src="/lib/CryptoJS/components/enc-base64.js"
></script>,
<script
key="url-template"
type="text/javascript"
src="/lib/url-template/url-template.js"
></script>,
<script
key="sigclient"
type="text/javascript"
src="/lib/apiGatewayCore/sigV4Client.js"
></script>,
<script
key="apigwcoreclient"
type="text/javascript"
src="/lib/apiGatewayCore/apiGatewayClient.js"
></script>,
<script
key="httpclient"
type="text/javascript"
src="/lib/apiGatewayCore/simpleHttpClient.js"
></script>,
<script
key="utils"
type="text/javascript"
src="/lib/apiGatewayCore/utils.js"
></script>,
<script
key="apigclient"
type="text/javascript"
src="/apigClient.js"
></script>,
]);
};