README
TTFL HTML helpers
Helpers for generating html template without dictating which template tag function to use.
import {element} from 'ttfl-html';
const link = (href, text) => element('a', { href }, text);
// Use with your favourite html tagging library
import html from 'encode-html-template-tag';
const example = link('//example.com', 'Click here for example.com')
example(html).render();
element
Create a tag with a given name, attributes and children. Elements that don't need closing tags are handled automatically.
Param | Type | Description |
---|---|---|
tag | string |
The name of the tag |
attributes | Object |
A dict of attributes to add to the tag |
...children | any |
Children to add inside the tag |