yepwrap
v0.0.3
Published
yet another templating nano tool for js proposal demo. conditional print wrapper text
Downloads
5
Readme
YepWrap
Fast examples
With actual none-falsy var's (named class
here) value
var tpl = '<${ name } $[[class="${ class }"]]>${ content }</${ name }>';
import t from 'yepwrap';
t(tpl, {name:'section',class:'zone-51',content:'42'});
result:
<section class="zone-51">42</section>
At first glance it available in ES2015:
`<${ name } class="${ class }">${ content }</${ name }>`
ok, see next exapmles:
With actual falsy var's (named class
here) value
import { templateNoSpace as ts } from 'yepwrap'; // likes t, but removes **all** spaces around
ts(tpl, {name:'section',class:null,content:'42'});
result:
<section>42</section>
import { templateOneSpace as t1s } from 'yepwrap'; // likes t, but removes **extra** spaces around
t1s(tpl, {name:'section',class:null,content:'42'});
result (focus on space):
<section >42</section>