const fs = require('fs'); const path = require('path'); const layoutDir = path.join(__dirname, 'sis_theme', 'templates', 'layout'); const files = fs.readdirSync(layoutDir).filter(f => f.startsWith('page--') && f.endsWith('.html.twig')); files.forEach(file => { const filePath = path.join(layoutDir, file); let content = fs.readFileSync(filePath, 'utf8'); // Replace paths like src="./UMass Amherst _ UMass Amherst_files/image.jpg" // or url('./UMass Amherst _ UMass Amherst_files/image.jpg') content = content.replace(/\.\/[^/]+_files\//g, "{{ directory }}/images/umass/"); fs.writeFileSync(filePath, content); console.log(`Updated paths in ${file}`); });