loving node pug more and more everyday you can even turn a PUG template into a JS function and call it to generate more HTML
https://pugjs.org/api/reference.html
NODE.JS
var fn = pug.compileFile('./templates/table.pug', {})
var html = fn({tablerows: [[4,5], [6,7]]});
console.log(html)
var html = fn({tablerows: [[8,9], [1,2]]});
console.log(html)
TABLE.PUG
as before
OUT.HTML
<table><tr><td>4</td><td>5</td></tr><tr><td>6</td><td>7</td></tr></table>
<table><tr><td>8</td><td>9</td></tr><tr><td>1</td><td>2</td></tr></table>
Top comments (0)