#!/usr/bin/env node /** * Script to update all HTML files in src/pages to use Handlebars partials * for navbar and footer */ import fs from 'fs'; import path from 'path'; import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); const pagesDir = path.join(__dirname, '..', 'src', 'pages'); // Get all HTML files in src/pages const htmlFiles = fs.readdirSync(pagesDir).filter((f) => f.endsWith('.html')); console.log(`Found ${htmlFiles.length} HTML files to process...`); let updatedCount = 0; let skippedCount = 0; for (const file of htmlFiles) { const filePath = path.join(pagesDir, file); let content = fs.readFileSync(filePath, 'utf-8'); let modified = false; // Check if already using partials if (content.includes('{{> navbar }}') && content.includes('{{> footer }}')) { console.log(` [SKIP] ${file} - already using partials`); skippedCount++; continue; } // Replace navbar - match from