vanilla-html

Only use string build template innerHTML

Usage no npm install needed!

<script type="module">
  import vanillaHtml from 'https://cdn.skypack.dev/vanilla-html';
</script>

README

vanilla-html

Only use string build template innerHTML

import { html } from "vanilla-html";

export const App = () => {
  const div = html`
    <div>
      <button class="btn">Click Me</button>
    </div>
  `;

  const btn = div.querySelector < HTMLButtonElement > "button";
  btn.onclick = () => {
    btn.innerHTML += "1";
  };
  return div;
};

document.body.append(App());