cleaned up wordpress
Some checks are pending
/ deploy (push) Waiting to run

This commit is contained in:
Loyyd 2026-06-11 09:21:43 +02:00
parent e495e875ac
commit 39f68f0051
922 changed files with 959 additions and 14704 deletions

View file

@ -0,0 +1,39 @@
import fs from "node:fs";
import path from "node:path";
const repoRoot = process.cwd();
const websiteRoot = path.join(repoRoot, "website");
function walkHtml(dir) {
return fs.readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
const fullPath = path.join(dir, entry.name);
if (entry.isDirectory()) {
return walkHtml(fullPath);
}
return entry.isFile() && entry.name.endsWith(".html") ? [fullPath] : [];
});
}
function removeWordPressResidue(html) {
return html
.replace(/\n?<!--\[if lt IE 9\]>\s*<script>[\s\S]*?<\/script>\s*<!\[endif\]-->\s*/g, "\n")
.replace(
/\n?\s*<script>\s*\/\* <!\[CDATA\[ \*\/var tribe_l10n_datatables = [\s\S]*?<\/script>/g,
""
)
.replace(/\n?<!-- Shortcodes Ultimate custom CSS - start -->\s*<!-- Shortcodes Ultimate custom CSS - end -->\s*/g, "\n");
}
let updated = 0;
for (const filePath of walkHtml(websiteRoot)) {
const original = fs.readFileSync(filePath, "utf8");
const cleaned = removeWordPressResidue(original);
if (cleaned !== original) {
fs.writeFileSync(filePath, cleaned);
updated += 1;
}
}
console.log(`Cleaned WordPress residue in ${updated} HTML files.`);