-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-ssr.js
55 lines (47 loc) · 1.47 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
/**
* Implement Gatsby's SSR (Server Side Rendering) APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/ssr-apis/
*/
// You can delete this file if you're not using it
// https://github.com/gatsbyjs/gatsby/issues/5667
// import React from "react"
// import { ServerStyleSheet, StyleSheetManager } from "styled-components"
// import { renderToString } from "react-dom/server"
// import { JssProvider } from "react-jss"
// import theme from "./src/themes/default" // eslint-disable-line
// import getPageContext from "./src/themes/getPageContext"
// exports.replaceRenderer = ({
// bodyComponent,
// replaceBodyHTMLString,
// setHeadComponents,
// }) => {
// const sheet = new ServerStyleSheet() //styled-components
// const pageContext = getPageContext()
// const app = (
// <JssProvider
// registry={pageContext.sheetsRegistry}
// generateClassName={pageContext.generateClassName}
// >
// <StyleSheetManager sheet={sheet.instance}>
// {React.cloneElement(bodyComponent, {
// pageContext,
// })}
// </StyleSheetManager>
// </JssProvider>
// )
// const body = renderToString(app)
// replaceBodyHTMLString(body)
// setHeadComponents([
// <style
// type="text/css"
// id="server-side-jss"
// key="server-side-jss"
// dangerouslySetInnerHTML={{
// __html: pageContext.sheetsRegistry.toString(),
// }}
// />,
// sheet.getStyleElement(),
// ])
// return
// }