This is the content
Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maael/html-chain
:link: A super small javascript library to make html by chaining javascript functions
https://github.com/maael/html-chain
chaining-javascript-functions html html-chain javascript javascript-library
Last synced: 2 months ago
JSON representation
:link: A super small javascript library to make html by chaining javascript functions
- Host: GitHub
- URL: https://github.com/maael/html-chain
- Owner: maael
- License: mit
- Created: 2015-07-24T21:56:34.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-07-06T16:00:34.000Z (over 8 years ago)
- Last Synced: 2024-11-01T22:50:40.297Z (2 months ago)
- Topics: chaining-javascript-functions, html, html-chain, javascript, javascript-library
- Language: JavaScript
- Homepage:
- Size: 10.7 KB
- Stars: 36
- Watchers: 5
- Forks: 5
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# html-chain
[![NPM Version](https://img.shields.io/npm/v/html-chain.svg?style=flat-square)](https://www.npmjs.com/package/html-chain)
[![Build Status](https://img.shields.io/travis/maael/html-chain.svg?style=flat-square)](https://travis-ci.org/maael/html-chain)
[![Code Climate](https://img.shields.io/codeclimate/github/maael/html-chain.svg?style=flat-square)](https://codeclimate.com/github/maael/html-chain)A super small (only 3.1kB) javascript library to make html by chaining javascript functions.
## Example
```js
var test = html()
.add('div', {className: 'container', data: { info: 'extraInformation' }})
.contains('div', {className: 'header'})
.contains('h5', {className: 'headerTitle', text: 'This is a header'}).end()
.and('div', {className: 'content'})
.contains('p', {text: 'This is the content'}).end()
.end()
.build();
```Produces -
```html
This is a header
```## Installation
### Node.js
Run
```npm install --save html-chain```
You can then access it with ```var html = require('html-chain');```### Script
Download and include the ```html.js``` script in your html.
``````