truerender

truerender builds static HTML pages from JSON API

Usage no npm install needed!

<script type="module">
  import truerender from 'https://cdn.skypack.dev/truerender';
</script>

README

TrueRender

Part of TruePage package

Fancy features

  • Render the handlebars templates and any REST APIs into static pages

Installation

npm install truerender

Example

var truerender = require('truerender');

var pages = [
{page:"index", template:__dirname+"/templates/index.html", data_urls: {page:"http://api.example.com/page/index", events:"http://api.example.com/events"}}
];

/*
Data from api will be available in template
ie. http://api.example.com/page/index will be available in {{page}}

*/

truerender.populateTemplate(pages[0], function(rendered_html){
        // do stuff with rendered html
});


License

MIT