0.1.1 • Published 3 years ago

wegine v0.1.1

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
3 years ago

wegine

A simple, lightweight, beautiful and easy-to-use universal template engine.

How to use

First, it only have two file: 1. element.ts. It defined a Base abstract class and a Element instance class.

  • Base. Base implements the basic interface that an html element should have. Such as child elements, attributes, events, styles, etc.
  • Element. Element extends Base, it renders the data in Base into a real dom node.
  1. utils.ts. Some useful functions are defined in there to facilitate you to quickly create templates.

API

For more, please visit src/element.ts and src/utils.ts files. Here are some commonly used APIs:

  • class Element(type: keyof HTMLElementTagNameMap) All method support chain-calls.
    • attr(attr: Attributes) Append attributes to your element.
    • id(id: string)
  • function h(type: keyof HTMLElementTagNameMap): Element Create element with Element.
  • function use(type: keyof HTMLElementTagNameMap): ElementCreator Shortcut to define h(...).

License

GPL-3.0.