Skip to content

Commit

Permalink
feat: reo setup
Browse files Browse the repository at this point in the history
  • Loading branch information
yathomasi committed Sep 2, 2024
1 parent 26f385c commit 8da704a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
2 changes: 2 additions & 0 deletions gatsby-browser.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/* eslint-env node */
require('./src/styles/global.css')

export { wrapPageElement } from './gatsby-shared'
18 changes: 18 additions & 0 deletions gatsby-shared.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { GatsbyBrowser, Script } from 'gatsby'

const GATSBY_REO_DEV_CLIENT_ID = process.env.GATSBY_REO_DEV_CLIENT_ID

export const wrapPageElement: GatsbyBrowser['wrapPageElement'] = ({
element
}) => {
return (
<>
{element}
{GATSBY_REO_DEV_CLIENT_ID && (
<Script id="rev-dot-dev">
{` !function(){var e,t,n;e="${GATSBY_REO_DEV_CLIENT_ID}",t=function(){Reo.init({clientID:"${GATSBY_REO_DEV_CLIENT_ID}"})},(n=document.createElement("script")).src="https://static.reo.dev/"+e+"/reo.js",n.async=!0,n.onload=t,document.head.appendChild(n)}();`}
</Script>
)}
</>
)
}
1 change: 1 addition & 0 deletions gatsby-ssr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { wrapPageElement } from './gatsby-shared'
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"include": [
"node_modules/@dvcorg/gatsby-theme-iterative",
"./src/**/*",
"./*.js"
"./*.js",
"./*.tsx"
]
}

0 comments on commit 8da704a

Please sign in to comment.