From d1a330aac9405a25f8d4f60c461b172ffb5293fd Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Sun, 6 Mar 2022 15:30:36 -0600 Subject: [PATCH] Include carbon script on static templates --- layouts-eleventy/default.11ty.js | 4 +++- nuxt.config.js | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/layouts-eleventy/default.11ty.js b/layouts-eleventy/default.11ty.js index 8ab8917..b09c746 100644 --- a/layouts-eleventy/default.11ty.js +++ b/layouts-eleventy/default.11ty.js @@ -71,7 +71,9 @@ const cleanNuxtLayout = ( layout ) => { }) // Strip out existing scripts - Array.from(document.querySelectorAll('script[src*=".js"]')).forEach( domNode => { + const scriptSelector = 'script[src*=".js"]:not(.include-on-static)' + + Array.from(document.querySelectorAll( scriptSelector )).forEach( domNode => { domNode.remove() }) diff --git a/nuxt.config.js b/nuxt.config.js index 52956c2..3cae2b5 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -123,6 +123,7 @@ export default { async: true, type: 'text/javascript', id: '_carbonads_js', + class: 'include-on-static', body: true } ]