You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.4 KiB
51 lines
1.4 KiB
|
|
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(`<script src="./wizard/${section}/${file}"></script>`) |
|
} |
|
}); |
|
}); |
|
|
|
|
|
//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!") |