rw-templater

1.1.2 • Public • Published

rw-templater

Build Status Coverage Status

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);

Readme

Keywords

none

Package Sidebar

Install

npm i rw-templater

Weekly Downloads

0

Version

1.1.2

License

MIT

Unpacked Size

9.89 kB

Total Files

9

Last publish

Collaborators

  • rw251