1.0.0 • Published 4 years ago

ttfl-html v1.0.0

Weekly downloads
2
License
ISC
Repository
gitlab
Last release
4 years ago

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.

ParamTypeDescription
tagstringThe name of the tag
attributesObjectA dict of attributes to add to the tag
...childrenanyChildren to add inside the tag
1.0.0

4 years ago