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

https://github.com/doodzik/javascript-html-tags

create html programmatically with javascript
https://github.com/doodzik/javascript-html-tags

Last synced: over 1 year ago
JSON representation

create html programmatically with javascript

Awesome Lists containing this project

README

          

# JavaScript HTML Tags

Create valid HTML with ease. Each HTML tag is a function with the same interface.

## Installation

```
npm i javascript-html-tags --save
```

## Usage

```
const {html, head, style, body, div, ...tags} = require('javascript-html-tags')

const cssRules = '.red{color:red}'

html(head(style(cssRules)),
body(div({class: 'red'}, 'hello'),
div('world!')))
```

## API

All arguments are concatenated. If the first one is an Object it will be interpreted as the html tags keys and values.

The ones with defaults are:
* style -> defaults to css
* script -> defaults to js

None tags are:
* xid -> returns a concatenated string of the arguments

If you find a tag that isn't supported open an issue

## LICENSE

MIT