@anzaui/engine - v0.6.0
    Preparing search index...

    Function compile

    • Compile chunks into a renderer. The template is flattened once into statics[0] slot[0] statics[1] … slot[n-1] statics[n]; a render does one type check on params, then one lookup per slot.

      Parameters

      Returns CompiledRenderer

      A function that binds params and returns the HTML.

      Values are inserted without HTML escaping unless options.escape is true; then {{name}} values go through escapeHtml and {{{name}}} values stay raw. extract and compile are plain JavaScript, so they also work on runtimes without a filesystem.

      import { compile, extract } from '@anzaui/engine';

      const render = compile(extract('<ui-card>{{title}}</ui-card>'), { escape: true });
      render({ title: 'Tom & Jerry' }); // '<ui-card>Tom &amp; Jerry</ui-card>'