A super simple and dynamic templating engine.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
dist
lib
spec
src
.gitignore
.travis.yml
MIT-LICENSE
README.md
package.json

README.md

jquery.templar

A super simple and dynamic templating engine.

data centric mode

If you have a template inside a string variable, you might be interested in using the direct method call to evaluate your template. This is how to do it:

new $.Templar('my %{funky} template').evaluate({
  funky: 'awesome'
})

// ==> 'my awesome template'

view centric mode

If you have your template inside your html and want to evaluate it, do it like this:

<div id="template">
  <h1>%{headline}</h1>
  <p>foo %{token} baz</p>
</div>
$('#template').templar({ headline: 'omg!', token: 'bar' })

Will result in:

<div id="template">
  <h1>omg!</h1>
  <p>foo bar baz</p>
</div>

License

Hereby place under MIT license.