Skip to content

Commit

Permalink
Enalbe analitycs
Browse files Browse the repository at this point in the history
  • Loading branch information
allevo committed Mar 29, 2024
1 parent c9a7aed commit dbfb171
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/website/scripts/print.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,17 @@ for (const page of pages) {
resources: "usable",
runScripts: "dangerously",
url: `${baseUrl}${page.path}`,
virtualConsole
});
await new Promise((resolve) => setTimeout(resolve, 1_000))

const resultHtml = dom.serialize()
const resultHTMWithoutScripts = resultHtml
.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script\s*>/gi, '')
.replace('<link rel="custom">', '<script type="module" defer src="/assets/bootstrap.bundle.min.js"></script>')
.replace('<link rel="custom">', `
<script type="module" defer src="/assets/bootstrap.bundle.min.js"></script>
<script type="module" defer src="/_vercel/insights/script.js"></script>
`)

const result = minify(resultHTMWithoutScripts, {
html5: true,
Expand Down Expand Up @@ -91,5 +95,3 @@ for (const image of images) {
for (const page of output) {
await fs.writeFile(`printed/${page.filename}`, page.html)
}


0 comments on commit dbfb171

Please sign in to comment.