Javascript template engine
Latest commit 53e2a9b Feb 22, 2014 @thecharge Update
Failed to load latest commit information.
src first source added Feb 22, 2014
LICENSE Initial commit Feb 22, 2014 Update Feb 22, 2014


Written by: Radoslav Sandov
Simple JavaScript template engine
Tag for stack Overflow issues: rage-template

Basic usage:
in the head you add references ti jquery and rage scripts:

  <script src=""></script>
  <script src="./rage-template-engine.js"></script>

add another script tag with the desired template path and id as name of the tempalte

   <script type="template" id="template-name" src="skin.jhtml"></script>

and wheneever you need it you can call it like:

// basic standalone example
    // initializing the template system
        var tpl = new rageTemaplteEngine();
        // render particular template with vars
        var $a = tpl.render('template-name',{message : "5 + 2 is equal to "});

Exaple of simple template from the render above:

   Here comes the flexibility in <strong>temaplte engines </strong> , you can perform operations like 
   {{ vars.message + ( 5 + 2)}}  

The Syntax

The syntax of this engine is simple, whatever you add in

{{ legit javascript code comes here }}

in the template file is being rendered as is, if you want to use a variable accessible from the global scope you simply type it, if you want to use variable passed to the view you type :
Variable passed to the view:

  {{ vars.variableNameGoesHere }}

Global scope variable/object:

  {{ globalVar }}
  {{  }}

Any participation in this project is welcome Bitdeli Badge