@nosto/autocomplete

    Function fromLiquidTemplate

    • Render a liquid template into a container

      Type Parameters

      Parameters

      • template: string

        Liquid template

      Returns (container: HTMLElement, state: State) => PromiseLike<void>

      Render function

      import { fromLiquidTemplate } from "@nosto/autocomplete/liquid";

      const render = fromLiquidTemplate(`
      <div>
      <h1>{{title}}</h1>
      <ul>
      {% for product in products %}
      <li>{{product.name}}</li>
      {% endfor %}
      </ul>
      </div>
      `);

      render(document.getElementById("container"), {
      title: "My Title",
      products: [
      { name: "Product 1" },
      { name: "Product 2" },
      { name: "Product 3" }
      ]
      });
    MMNEPVFCICPMFPCPTTAAATR