0.1.1 • Published 4 years ago
wegine v0.1.1
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.Baseimplements the basic interface that an html element should have. Such as child elements, attributes, events, styles, etc.Element.ElementextendsBase, it renders the data in Base into a real dom node.
- 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): ElementCreate element withElement.function use(type: keyof HTMLElementTagNameMap): ElementCreatorShortcut to define h(...).
License
GPL-3.0.