Skip to content

Commit

Permalink
docs: init partytown script
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdbradley committed Feb 4, 2022
1 parent f250faa commit ff2fdbc
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
.DS_Store
/dist/
/docs/site/dist/
/docs/site/public/~partytown/
/docs/site/src/table-of-contents.ts
/docs/site/src/pages/
node_modules/
/integration/
/lib/
/react/
/tests/~partytown/
/tests/nextjs/public/
/tests/benchmarks/screenshots/
/tests/videos/
Expand Down
12 changes: 7 additions & 5 deletions docs/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "npm run docs && astro build",
"dev": "npm run partytown && astro dev",
"start": "npm run partytown && astro dev",
"build": "npm run partytown && npm run docs && astro build",
"preview": "astro preview",
"docs": "node ./load-docs.mjs"
"docs": "node ./load-docs.mjs",
"partytown": "partytown copylib public/~partytown"
},
"devDependencies": {
"@astrojs/renderer-preact": "^0.4.0",
"astro": "^0.22.20",
"@builder.io/partytown": "^0.2.4",
"astro": "^0.23.0-next.1",
"domino": "^2.1.6",
"front-matter": "^4.0.2",
"marked": "^4.0.12"
Expand Down
26 changes: 18 additions & 8 deletions docs/site/src/components/HeadCommon.astro
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
---
import { partytownSnippet } from '@builder.io/partytown/integration';
const partytownSnippetHtml = partytownSnippet({
debug: true
});
---

<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
Expand All @@ -15,11 +22,14 @@ Array.from(document.getElementsByTagName('pre')).forEach((element) => {
});
</script>

<!-- Global site tag (gtag.js) - Google Analytics -->
<!-- <script async src="https://www.googletagmanager.com/gtag/js?id=G-TEL60V1WM9"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-TEL60V1WM9');
</script> -->
<!-- Partytown Snippet -->
<!-- <script set:html={partytownSnippetHtml}></script> -->
<!-- End Partytown Snippet -->

<!-- Google Tag Manager -->
<script type="text/partytown">(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-W275NLW');</script>
<!-- End Google Tag Manager -->
2 changes: 1 addition & 1 deletion scripts/copy-site.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async function copySiteDist() {
})
);

await copy(join(rootDir, 'lib'), join(dist, '~partytown'));
await copy(join(rootDir, 'lib'), join(dist, '~partytown'), { overwrite: true });
}

copySiteDist();

1 comment on commit ff2fdbc

@vercel
Copy link

@vercel vercel bot commented on ff2fdbc Feb 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.