From 2e82c76b53354624a5b7f2a7d2595397d63dee1b Mon Sep 17 00:00:00 2001
From: mrugesh <1884376+raisedadead@users.noreply.github.com>
Date: Thu, 17 Oct 2019 02:41:33 +0530
Subject: [PATCH] Revert "feat: load scripts conditionally based on path "
(#37351)
This reverts commit 87be96a2448124a83909492384a68ecb58fa5757.
---
client/gatsby-ssr.js | 6 ++++++
client/utils/gatsby/layoutSelector.js | 17 -----------------
2 files changed, 6 insertions(+), 17 deletions(-)
diff --git a/client/gatsby-ssr.js b/client/gatsby-ssr.js
index 9306aa55aa..cfdb4f187a 100644
--- a/client/gatsby-ssr.js
+++ b/client/gatsby-ssr.js
@@ -38,6 +38,12 @@ export const onRenderBody = ({ setHeadComponents, setPostBodyComponents }) => {
`
}}
key='gtag-dataLayer'
+ />,
+
].filter(Boolean)
);
diff --git a/client/utils/gatsby/layoutSelector.js b/client/utils/gatsby/layoutSelector.js
index 1d12fd5bf2..c2a1d48fdd 100644
--- a/client/utils/gatsby/layoutSelector.js
+++ b/client/utils/gatsby/layoutSelector.js
@@ -7,19 +7,6 @@ import {
} from '../../src/components/layouts';
import FourOhFourPage from '../../src/pages/404';
-const scriptAdd = (id, key, async, src) => {
- var s = document.createElement('script');
- s.type = 'text/javascript';
- s.id = id;
- s.key = key;
- s.async = async;
- s.onload = function() {
- console.log('Stripe injected');
- };
- s.src = src;
- document.getElementsByTagName('head')[0].appendChild(s);
-};
-
export default function layoutSelector({ element, props }) {
const {
location: { pathname }
@@ -40,10 +27,6 @@ export default function layoutSelector({ element, props }) {
);
}
- if (/^\/donate(\/.*)*/.test(pathname)) {
- scriptAdd('stripe-js', 'stripe-js', false, 'https://js.stripe.com/v3/');
- return {element};
- }
return {element};
}