From 7a29ea4a504de184a026cf73b409738e74f15102 Mon Sep 17 00:00:00 2001 From: Pavlo Karatsiuba Date: Wed, 30 Nov 2022 12:21:05 +0100 Subject: [PATCH] issue#127 Removing google-analitics script and meta OGP tags. Replacing inline JS's in HTML files was redesigned. --- steps/transform.ts | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/steps/transform.ts b/steps/transform.ts index 1f53a52..31affe1 100644 --- a/steps/transform.ts +++ b/steps/transform.ts @@ -63,26 +63,34 @@ const convertDocuments = async (): Promise => { const extractLanguageElements = async (fileName, html): Promise => { const $ = cheerio.load(html); + $('meta[property^="og:"]').remove(); await Promise.all($('script') - .toArray() - .map(script => op.get(script, 'children.0.data', '')) - .filter(x => x) - .map(async (script, index) => { - const newFileName = md5(script); - try { - await fs.promises.writeFile(`${outDir}${newFileName}.js`, script.trim(), 'utf8'); - html = html.replace(script, `