html-text-generator
v1.1.2
Published
Made for innerHTML, generate HTML text in a simple way
Downloads
5
Readme
html-text-generator
Generate Element in a simple way.
install
$ npm install --save html-text-generator
Usage
- import html-text-generator
const r = require('html-text-generator')
- use it!
r('btn')('click me')
//=> <div class="btn">click me</div>
r('btn', 'botton')('content')
//=> <botton class="btn">content</botton>
r({
id: 'main',
style: 'color: #888'
})('ctt')
//=> <div id="main" style="color: #888">ctt</div>
r('demo-jpg', 'img')('./demo.jpg')
//=> <img class="demo-jpg" src="./demo.jpg">
r('para-container', 'main')(
r('para-title', 'h1')('TITLE'),
r('para-ctt', 'p')('Lorem ipsum dolor sit amet quae.'),
r({}, 'hr')(),
r('para-after')()
)
//=> <main class="para-container">
// <h1 class="para-title">TITLE</h1>
// <p class="para-ctt">Lorem ipsum dolor sit amet quae.</p>
// <hr>
// <div class="para-after"></div>
// </main>
License
MIT
todo
- [x] to Element
- [ ] autoprefixer support
contributing
- Fork this repo
- Create your feature branch:
git checkout -b MY-NEW-FEATURE
- Commit your changes:
git commit -am 'ADD SOME FEATURE'
- Push to the branch:
git push origin MY-NEW-FEATURE
- Submit a pull request :D