An open API service indexing awesome lists of open source software.

https://github.com/caub/dom-tagged-template

Tagged template function for DOM building
https://github.com/caub/dom-tagged-template

Last synced: about 2 months ago
JSON representation

Tagged template function for DOM building

Awesome Lists containing this project

README

          

## DOM helper to create elements/fragments similarly to jsx

[![Build Status](https://travis-ci.org/caub/dom-tagged-template.svg?branch=master)](https://travis-ci.org/caub/dom-tagged-template)

```js
const $ = require('dom-tagged-template');

const ul = $`

    {e.target.style.color=`hsl(${Math.floor(360*Math.random())},100%,50%)`}}>
    ${[1,2,3].map(x => $`
  • ${x}
  • `)}
`.firstChild;

const div = $`


Hello ${'!'.repeat(4)}
${ul}
`.firstChild;

const fragment = $`
hello
@


world
`;

```

[live example](https://jsfiddle.net/crl/hmth3ru7)