0.0.1 • Published 6 years ago

estml v0.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

ES TML

Render html ES6 way :)
npm package JavaScript Style Guide

Install

npm i estml

Usage

const T = require('estml')

Simple tag with no attribute

T('br')

toString result

<br>

Simple tag with attribute

T('span', {class: 'foo'})

toString result

<span class="foo"></span>

Simple tag with inner html

T('h1')`TITLE!`

result

<h1>TITLE!</h1>

Self closing tag

T('foo-component/')

toString result

<foo-component/>

Mixed example

T('div')`
  ${T('input', {type: 'text', class: 'foo'})}
  Foo Text${T('br')}
  ${T('div')`
    inside div
    ${T('foo-component/')}
  `}
`

result

<div>
  <input type="text" class="foo">
  Foo Text<br>
  <div>
    inside div
    <foo-component/>
  </div>
</div>

What is the benefit of using this?

Nothing.

Just read the code and have fun :)