rw-templater
v1.1.2
Published
An extremely small opinionated templating engine
Downloads
5
Readme
rw-templater
Minimalistic templating engine inspired (nicked) largely from https://github.com/premasagar/tim
Usage
index.html
<script type='text/rw' id='about'>
<p>ABOUT: Hello, my name is {{name}}. I'm {{age}} years old.</p>
</script>
<script type='text/rw' id='boolTest'>
<div>
The following line only appears is isData is truthy
</div>
{{isData}}
THERE IS DATA
{{/isData}}
</script>
<script type="text/rw" id="loopTest">
If fruit is an array then this iterates through them
<ul>
{{fruit}}
<li>{{name}} are {{colour}}</li>
{{/fruit}}
</ul>
</script>
file.js
import { Template } from 'rw-templater';
document.getElementById('main').innerHTML = Template.it('templateId', data);