const fs = require('fs'); const wizardContentHtml = []; const wizardScriptsHtml = []; const sections = fs.readdirSync('webcontent/wizard') sections.forEach(section => { const files = fs.readdirSync('webcontent/wizard/'+section) files.forEach(file => { //console.log("file: ", file) if (file.endsWith(".html")) { wizardContentHtml.push(fs.readFileSync(`webcontent/wizard/${section}/${file}`)) } if (file.endsWith(".js")) { wizardScriptsHtml.push(``) } }); }); //console.log("wizardContentHtml.length: ", wizardContentHtml.length) //console.log("wizardScriptsHtml.length: ", wizardScriptsHtml.length) let template = fs.readFileSync('webcontent/indexTemplate.html').toString(); template = template.replace("__WIZARDCONTENT__", wizardContentHtml.join("\n")) template = template.replace("__WIZARDSCRIPTS__", wizardScriptsHtml.join("\n")) fs.writeFileSync('webcontent/index.html', template); console.log("index.html template has been rendered!") const imageOverlay = fs.readdirSync('image-overlay') const imageOverlayMap = {}; imageOverlay.forEach(file => { imageOverlayMap[file] = fs.readFileSync(`image-overlay/${file}`).toString('utf-8'); }); const imageOverlayMapJS = ` module.exports = ${JSON.stringify(imageOverlayMap, null, " ")}; ` fs.writeFileSync('imageOverlayFiles.js', imageOverlayMapJS); console.log("imageOverlayFiles.js has been rendered!")