A lightweight HTML element builder
import * as lw from "lightwrite";
// or as String:
lw.as.string(
lw("div").class("greeting")(lw("p").class("greeting-text")("hello!"))
);
//"<div class="greeting"><p class="greeting-text">hello!</p></div>"
// or as Element:
lw.as.element(
lw("div").class("greeting")(lw("p").class("greeting-text")("hello!"))
);
//<div class="greeting"><p class="greeting-text">hello!</p></div>
This will initialize a new LWElement
This can write the pure text instead of the html
This can write the html instead of the text (default, when passing in strings)
This will convert the LWElement to a string or a HTMLElement
This will convert the LWElement to a string
This will convert the LWElement to a HTMLElement
This supports importing defaults
This is an registry for elements
This is the equivalent of lw("key")
This will set the attribute key to value If no parameter is passed it will remove that attribute
This will set the attribute key to value If no parameter is passed it will remove that attribute
This is only supposed to be used with Tagged templates
This will add multiple elements as a child.
This will add multiple elements as a child.
This will add one Element as a child
This is only supposed to be used with Tagged templates