micro-templating

use `micro-template` by John Resig on memory

Usage no npm install needed!

<script type="module">
  import microTemplating from 'https://cdn.skypack.dev/micro-templating';
</script>

README

micro-templating

Build Status

Respecting micro-templating

why

  • Want to use micro-templating on memory
  • Want to find tmpl string by NOT document.getElementById(tpl_name) BUT pool[tpl_name]

spec

// you can generate this pool by using `gulp-micro-templating`
this.MicroTemplates = {"foo":"<a href=\"<%= url %>\"><%= name %></a>"};

var tmpl = require('micro-templating').tmpl;

var html = tmpl("foo", {url:"https://npmjs.org/~otiai10", name:"otiai10"});
// == <a href="https://npmjs.org/~otiai10">otiai10</a>