6.0.0 • Published 5 years ago

@implode-nz/html v6.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
5 years ago

HTML

This library is a utility for writing HTML easier.

Install

Simpily run:

npm install --save @implode-nz/html

Loading

Once this library is installed, load the file using a script or requirejs.

Script loading:

<script src="path/to/HTML/index.min.js"></script>

Requirejs loading:

requirejs(['path/to/HTML/index.min.js'], HTML => {
    /* Do stuff with HTML */
});

If requirejs is loaded before the HTML script, then HTML is exported:

requirejs(['HTML'], HTML => {
    /* Do stuff with HTML */
});

Usage

The full usage is one of these options (with the obvious generalizations):

HTML.element.class1.class2(id, options)([...inner]);
HTML.element.class()(inner);
HTML.element(options, ...inner);
HTML.element(options, inner);

Creating a div:

HTML.div()();
HTML.div([]);

Creating a div with settings:

HTML.div(
    {
        contentEditable: 'true',
        onclick: () => console.log('Clicked')
    },
    []
);

Creating a div with interior elements, class class1, and id element:

HTML.div.class1('element', HTML.span([]));
5.2.0

5 years ago

6.0.0

5 years ago

5.1.0

5 years ago

5.0.0

5 years ago