js2html

0.0.2 • Public • Published

js2html

Yet the easiest way to js the html

To turn

['audio#id.c1.c2', {
  preload: true,
  autoplay: false,
  loop: null,
  //'class': 'c3 c4',
  //'class': ['c3', 'c4'],
  'class': {
    c3: true,
    c4: true,
    c5: false
  },
  'data-a': '',
  'data-b': 'b',
  'data-c': {
    c: 1,
    c1: 'sad"\'s'
  }
}, [
  ['source/', {
    type: 'audio/mp3',
    src: 'media/audio-01.mp3'
  }]
]]

Into (with pretty)

<audio id="id" preload data-a="" data-b="b"
data-c={"c":1,"c1":"sad\"'s"} class="c1 c2 c3 c4">
  <source type="audio/mp3" src="media/audio-01.mp3"/>
</audio>

More at test.js

What's It For?

As a core for building html templating lang such as jade

(your_lang) <=> js <=> html

A Little Hack..

For <!doctype html>

['!doctype', { html: true }]

Readme

Keywords

none

Package Sidebar

Install

npm i js2html

Weekly Downloads

3

Version

0.0.2

License

none

Last publish

Collaborators

  • fritx