From fff01530bbbfed7e7b76566d15ade9836eeaf14f Mon Sep 17 00:00:00 2001 From: Li Jin Date: Thu, 12 Feb 2026 12:04:03 +0800 Subject: Again. [skip CI] --- doc/scripts/fix-css-link-rel.mjs | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 doc/scripts/fix-css-link-rel.mjs (limited to 'doc/scripts') diff --git a/doc/scripts/fix-css-link-rel.mjs b/doc/scripts/fix-css-link-rel.mjs deleted file mode 100644 index 4c48868..0000000 --- a/doc/scripts/fix-css-link-rel.mjs +++ /dev/null @@ -1,32 +0,0 @@ -import { readdirSync, readFileSync, statSync, writeFileSync } from "node:fs"; -import { join } from "node:path"; - -const distRoot = "docs/.vitepress/dist"; -const preloadStylesheetRelPattern = /rel="preload stylesheet"/g; -const stylesheetAsPattern = /(]*rel="stylesheet"[^>]*?)\s+as="style"/g; - -function walk(dir, files = []) { - for (const entry of readdirSync(dir)) { - const fullPath = join(dir, entry); - const stat = statSync(fullPath); - if (stat.isDirectory()) { - walk(fullPath, files); - } else if (fullPath.endsWith(".html")) { - files.push(fullPath); - } - } - return files; -} - -let updated = 0; -for (const filePath of walk(distRoot)) { - const original = readFileSync(filePath, "utf8"); - let fixed = original.replace(preloadStylesheetRelPattern, 'rel="stylesheet"'); - fixed = fixed.replace(stylesheetAsPattern, "$1"); - if (fixed !== original) { - writeFileSync(filePath, fixed, "utf8"); - updated += 1; - } -} - -console.log(`[fix-css-link-rel] Updated ${updated} HTML files.`); -- cgit v1.2.3-55-g6feb