-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwriteHtml.js
More file actions
27 lines (18 loc) · 814 Bytes
/
writeHtml.js
File metadata and controls
27 lines (18 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const fs = require('fs');
const simpleReplace = require('simple-replace');
// Unit ID = 7.14
// HTML Array = [<div>.. </div>, etc]
// Just generate a thing that puts the UnitID in the Titles, and puts a bunch of HTML arrays in the body
let replaceHash = {
unit: '7.14',
content: ['<div id="ab1" class="CTATTextInput">Hello</div>','<div id="ab2" class="CTATTextInput">Goodbye</div>'].join('\n\t\t')
}
// Now do this for every single thing... the replaceHash should vary, obviously
// 'template.html' should only be loaded once (async.parallel??, just make everything else depend on it???)
fs.readFile('template.html', 'utf8', function(err, template) {
if (err) {
throw err;
}
let newFileContents = simpleReplace(template, replaceHash);
console.log(newFileContents);
});