kit
    Preparing search index...

    Function render

    • Render template (adapted from doT.js)

      The data made available to the template is always on the data key, e.g.: renderer({ myVal: "xx" }) ... will be accessible on <%= data.myVal %>

      The default delimiters are customised to work without conflicts with Blade and Twig:

      <% %>	for evaluation
      <%= %> for interpolation
      <%? %> for conditionals
      <%~ %> for array iteration
      <%# %> for compile-time evaluation/includes and partials
      <%## #%> for compile-time defines

      Unsupported:
      <%! %> for interpolation with encoding

      Parameters

      • tmpl: string
      • Optionaldef: Definitions

      Returns RenderFunction

      import { render } from "...";

      const data = { name: "XYZ" };
      const tpl = `Hello <%= data.name %>`;
      const renderer = render(tpl);

      console.log(renderer(data)); // outputs 'Hello XYZ'