ttfl-html

1.0.0 • Public • Published

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

Package Sidebar

Install

npm i ttfl-html

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

5.55 kB

Total Files

6

Last publish

Collaborators

  • paulkiddle