1.1.0 • Published 7 years ago

gettpl v1.1.0

Weekly downloads
3
License
ISC
Repository
github
Last release
7 years ago

getTpl

Small script that provides a very simple HTML template for your javascript projects.

Installation

On top of your javascript file :

import getTpl from 'gettpl';

Usage

  • The HTML template is in your HTML page (hidden) and contains variables to be replaced :
<script id="my_template_id" type="text/template">
    <span>
        {{ foo }}
    </span>
    <p>
        {{ foo2 }}
    </p>
</script>
  • In your javascript, call the template with its id and variables will be replaced via an object
getTpl({ 
    foo:'bar', 
    foo2:'bar2' 
}, 'my_template_id'); 

Returns:

<span>
    bar
</span>
<p>
    bar2
</p>
1.1.0

7 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago