mintp

0.1.0 • Public • Published

mintp.js

A minimalist template engine.

Example Usage

<script id="t1" type="text/html">
<{{ tag }}>{{ content }}</{{ tag }}>
</script> 
 
<script id="t2" type="text/html">
<{{ tag }}>
  {{ mintp('#t1', {tag: 'p', content: tag}) }}
</{{ tag }}>
</script> 
 
<script id="t3" type="text/html">
<{{ tag }}>
  {{ t2.map(mintp.bind(null, '#t2')).join('') }}
</{{ tag }}>
</script> 
document.body.innerHTML = mintp('#t3', {
  tag: 'button',
  t2: [{tag: 'h1'}, {tag: 'h2'}]
});

Result

<button>
  <h1>
    <p>h1</p>
  </h1>
  <h2>
    <p>h2</p>
  </h2>
</button>

Readme

Keywords

Package Sidebar

Install

npm i mintp

Weekly Downloads

0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • rliang