Template types - aerix-nl/nota GitHub Wiki

Static templates

The most simple template is a static template. Nota will automatically scan the selected template's template.html for any <script> tag. If there are none, it automatically assumes the template is static. When rendering in this mode Nota will wait for all the template's page resources like images to have finished loading and then perform the capture automatically. This is done by listening for any resource requests calls on the backend. If all requests have loaded, and no new request has been made after a given timeout (which can be configured in config-default.json or overridden by a template's nota.json declaration), it is assumed all assets have loaded, capture begins. This makes Nota a luxury equivalent of rasterize.js.

Scripted templates

If there are script tags found Nota will wait for all page resources to finish loading before injecting data and capturing. But after the resources have been loaded Nota will also allow the template some time set up and allow possible template code to initialize. This timeout duration is also defined in default-config.json at template.timeouts, and can also be overridden by a template's nota.json declaration.

After the templateInitSlow timeout it is assumed the template has had enough time to initialize. If data to render has been provided, it will be injected to Nota client. Listening for data:injected injection events allows your template to pick up the data and render it. This can be done with Nota.on('data:injected', callbackFunction);. More information in the Nota client API wiki.

⚠️ **GitHub.com Fallback** ⚠️