blob: 74b68dd83b07d279f85545cf569b64bcec9c5085 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
const mustache = require('mustache')
const fs = require('fs')
const htmlFile = process.argv[2]
const exampleJson = process.argv[3]
if (!htmlFile || !exampleJson) {
console.log('usage: render-mustache <htmlFile> <exampleJson>')
return 1
}
const html = fs.readFileSync(htmlFile, 'utf8')
const json = fs.readFileSync(exampleJson, 'utf8')
const example = JSON.parse(json)
const output = mustache.render(html, example);
console.log(output)
|