const fs = require("fs"); const serverPath = require("./serverPath.js") const pages = ["/index.html", "/blog/index.html", "/blog/reviews/index.html", "/project/index.html"]; const { header, footer} = require(serverPath+"/html.js") const { exec } = require('child_process'); for (let x = 0; x < pages.length; x++) { console.log(x) page = serverPath + pages[x] console.log("editing", page) // Header let command = `sed -i 's|||' ${page}`; exec(command, (error, stdout, stderr) => { if (error) { console.error(`Error: ${error.message}`); return; } else { console.log(`Successfully added header to page`) } }); // Footer command = `sed -i 's|||' ${page}`; exec(command, (error, stdout, stderr) => { if (error) { console.error(`Error: ${error.message}`); return; } else { console.log(`Successfully added footer to page`) } }); }