Created
July 30, 2018 11:50
-
-
Save ThomasPe/02e0c55c0a925c5492b7c5c026963e08 to your computer and use it in GitHub Desktop.
Render index.html from mustache templates & dynamic data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function renderSite(){ | |
context.log("render site"); | |
var pageFile = ""; | |
mu.compileText('index.mustache', context.bindings.indexTemplate, function (err, parsed) { | |
var renderstream = mu.render(parsed, { news: mynews, links: mylinks }); | |
renderstream.on('data', function (data) { | |
pageFile += data; | |
}); | |
renderstream.on('end', function (data) { | |
context.log("done creating index.html"); | |
uploadSite(pageFile); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment