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
- Host: GitHub
- URL: https://github.com/caub/dom-tagged-template
- Owner: caub
- Created: 2017-08-17T21:16:50.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-11-24T15:04:42.000Z (over 8 years ago)
- Last Synced: 2025-02-28T10:00:53.372Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## DOM helper to create elements/fragments similarly to jsx
[](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%)`}}>
- ${x} `)}
${[1,2,3].map(x => $`
const div = $`
Hello ${'!'.repeat(4)}
${ul}
const fragment = $`
hello
@
world
`;
```
[live example](https://jsfiddle.net/crl/hmth3ru7)