-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgatsby-ssr.js
73 lines (71 loc) · 1.98 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
import React from 'react'
import { withPrefix } from 'gatsby'
import RootElement from './src/components/root-element'
export const wrapRootElement = ({ element }) => {
return <RootElement>{element}</RootElement>
}
export const onRenderBody = ({ setHeadComponents }) => {
setHeadComponents([
<link
key="Inconsolata-Bold-w2"
rel="preload"
href={`${withPrefix('/')}fonts/Inconsolata-Bold.woff2`}
as="font"
type="font/woff2"
crossOrigin="anonymous"
/>,
<link
key="Inconsolata-Regular-w2"
rel="preload"
href={`${withPrefix('/')}fonts/Inconsolata-Regular.woff2`}
as="font"
type="font/woff2"
crossOrigin="anonymous"
/>,
<link
key="Inconsolata-Light-w2"
rel="preload"
href={`${withPrefix('/')}fonts/Inconsolata-Light.woff2`}
as="font"
type="font/woff2"
crossOrigin="anonymous"
/>,
<style
key="inline-style"
dangerouslySetInnerHTML={{
__html: `
@font-face {
font-family: 'Inconsolata-Bold';
font-style: normal;
font-weight: 700;
font-display: swap;
src: url(${withPrefix(
'/'
)}fonts/Inconsolata-Bold.woff2) format('woff2'),
url(${withPrefix('/')}fonts/Inconsolata-Bold.woff) format('woff');
}
@font-face {
font-family: 'Inconsolata-Regular';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(${withPrefix(
'/'
)}fonts/Inconsolata-Regular.woff2) format('woff2'),
url(${withPrefix('/')}fonts/Inconsolata-Regular.woff) format('woff');
}
@font-face {
font-family: 'Inconsolata-Light';
font-style: normal;
font-weight: 300;
font-display: swap;
src: url(${withPrefix(
'/'
)}fonts/Inconsolata-Light.woff2) format('woff2'),
url(${withPrefix('/')}fonts/Inconsolata-Light.woff) format('woff');
}
`,
}}
/>,
])
}