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

    Function extract

    • Split a template into static text and {{slot}} / {{{raw}}} chunks, scanning the string once.

      Parameters

      • template: string

        The template source.

      Returns Chunk[]

      The chunks in order.

      Placeholders are the whole syntax: there are no loops, conditionals, filters, includes or comments.

      AnzaError TEMPLATE for an unclosed {{ or {{{, or an empty {{}}.

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

      extract('<b>{{title}}</b>{{{body}}}');
      // [
      // { type: 'static', value: '<b>' },
      // { type: 'slot', name: 'title' },
      // { type: 'static', value: '</b>' },
      // { type: 'raw', name: 'body' },
      // ]