Skip to content

Commit 0c7d0fd

Browse files
committed
fix: correct stylesheet link attributes in VitePress build
VitePress was generating invalid HTML with rel="preload stylesheet" and as="style". Updated buildEnd hook to properly convert these to standard rel="stylesheet" links.
1 parent 7211378 commit 0c7d0fd

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

docs/.vitepress/config.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ export default defineConfig({
2121
} else if (file.endsWith('.html')) {
2222
let content = fs.readFileSync(filePath, 'utf-8');
2323
content = content.replace(
24-
/rel="preload stylesheet"/g,
25-
'rel="stylesheet"'
24+
/<link rel="preload stylesheet"([^>]*) as="style">/g,
25+
'<link rel="stylesheet"$1>'
2626
);
2727
fs.writeFileSync(filePath, content, 'utf-8');
2828
}

0 commit comments

Comments
 (0)