wegine

0.1.1 • Public • Published

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.

Package Sidebar

Install

npm i wegine

Weekly Downloads

0

Version

0.1.1

License

GPL-3.0

Unpacked Size

7.22 kB

Total Files

11

Last publish

Collaborators

  • wgxh-cli