1.1.2 • Published 6 years ago

rw-templater v1.1.2

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

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

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago