stristri examples

Table of Contents

Quick Take

import { strict as assert } from "assert";
import { stri } from "stristri";

// strips both HTML and Nunjucks, leaves text only:
assert.equal(
  stri(
    `<html><div>The price is{% if data.price > 100 %} high{% endif %}</div>`,
    {
      html: true,
      css: true,
      text: false,
      templatingTags: true,
    }
  ).result,
  "The price is high"
);