1.0.3 • Published 9 years ago

microtpl v1.0.3

Weekly downloads
1
License
ISC
Repository
github
Last release
9 years ago

Micro Templating Lib

It can:

  • Insert strings into an element or as attributes.
  • Nested referencing, as in data-template-part="media.image.small".
  • Basic loops of arrays of objects.

Install

`npm install microtpl

Insert something

<h1 data-template-part="title"></h1>

Loop over Array

JS

var data = {
  items: [
    {title: 'a title'},
    {title: 'another title'},
  ],
};

micro.inject($el, data);

HTML

<ul>
  <li data-repeat="items">
    <span data-template-part="title"></span>
  </li>
</ul>

Inject Attribute

<img src=""
     data-template-part="image.src"
     data-template-attr="src">
1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago