dombat

ultra-lightweight DOM builder

Usage no npm install needed!

<script type="module">
  import dombat from 'https://cdn.skypack.dev/dombat';
</script>

README

dombat

Install

From NPM:
npm install dombat

From GitHub:
npm install xist/dombat

Example

import { html, head, title, body, div, p } from "dombat";
// import * as tag from "dombat"; <-- or you can do this

const dom = html(
  head(title("Example DOM")),
  body(div(p("This is an example paragraph inside a div.")))
);

The output of dom.getHTML() would be:

<html>
  <head>
    <title>Example DOM</title>
  </head>
  <body>
    <div>
      <p>This is an example paragraph inside a div.</p>
    </div>
  </body>
</html>

Contribute

Pull requests are encouraged.