Skip to content

Commit

Permalink
Merge pull request #89 from newrelic/jerel/example-docs
Browse files Browse the repository at this point in the history
Component Examples
  • Loading branch information
jerelmiller authored Jun 3, 2020
2 parents 19a8485 + dd0806b commit 394ac94
Show file tree
Hide file tree
Showing 33 changed files with 920 additions and 28 deletions.
13 changes: 12 additions & 1 deletion gatsby-ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@

// This is needed to ensure the NR1 SDK can load properly
const React = require('react');
const { JS_BUNDLE } = require('./src/utils/sdk');

exports.onPreRenderHTML = ({ getHeadComponents, replaceHeadComponents }) => {
exports.onPreRenderHTML = ({
getHeadComponents,
replaceHeadComponents,
getPostBodyComponents,
replacePostBodyComponents,
}) => {
replaceHeadComponents([
...getHeadComponents(),
<script
Expand Down Expand Up @@ -36,4 +42,9 @@ exports.onPreRenderHTML = ({ getHeadComponents, replaceHeadComponents }) => {
src="//nr1.nr-assets.net/lib/d3/3.5.17/d3.js"
/>,
]);

replacePostBodyComponents([
...getPostBodyComponents(),
<script key="nr1-sdk" crossOrigin="anonymous" src={JS_BUNDLE} />,
]);
};
Loading

0 comments on commit 394ac94

Please sign in to comment.