Fix about css

This commit is contained in:
fraxle
2026-05-18 23:10:51 +01:00
parent 85c415d1f5
commit fc1795bb70
2 changed files with 14 additions and 1618 deletions
File diff suppressed because it is too large Load Diff
+14 -3
View File
@@ -66,9 +66,11 @@ function bumpVersion() {
return Math.floor(Date.now() / 1000).toString(36); return Math.floor(Date.now() / 1000).toString(36);
} }
// Swap dev asset tags in HTML for bundle tags // Swap dev asset tags in HTML for bundle tags.
// Strips the main sunscope.css link but preserves standalone CSS files
// like about.css that are not part of the main bundle.
function rewriteHTML(html, version) { function rewriteHTML(html, version) {
html = html.replace(/<link\s[^>]*href=["'][^"']*assets\/[^"']*\.css[^"']*["'][^>]*>/gi, ''); html = html.replace(/<link\s[^>]*href=["'][^"']*assets\/sunscope\.css[^"']*["'][^>]*>/gi, '');
html = html.replace(/<script\s[^>]*src=["'][^"']*assets\/js\/[^"']*["'][^>]*><\/script>/gi, ''); html = html.replace(/<script\s[^>]*src=["'][^"']*assets\/js\/[^"']*["'][^>]*><\/script>/gi, '');
const css = ' <link rel="stylesheet" href="./assets/bundle.min.css?v=' + version + '">'; const css = ' <link rel="stylesheet" href="./assets/bundle.min.css?v=' + version + '">';
const js = ' <script defer src="./assets/bundle.min.js?v=' + version + '"></script>'; const js = ' <script defer src="./assets/bundle.min.js?v=' + version + '"></script>';
@@ -143,7 +145,16 @@ async function build() {
console.log(' -> ' + htmlFile); console.log(' -> ' + htmlFile);
} }
// 5. Copy static files // 5. Copy standalone CSS files that are not part of the main bundle
for (const f of ['about.css']) {
const src = path.join(ROOT, 'assets', f);
if (fs.existsSync(src)) {
copyFile(src, path.join(ASSETS, f));
console.log(' -> assets/' + f);
}
}
// 6. Copy static files
console.log(' Copying static files...'); console.log(' Copying static files...');
for (const f of ['robots.txt', 'sitemap.xml', 'og-image.png']) { for (const f of ['robots.txt', 'sitemap.xml', 'og-image.png']) {
const src = path.join(ROOT, f); const src = path.join(ROOT, f);