UNPKG

goji

Version:

An HTML templating engine inspired by Thymeleaf

656 lines (187 loc) 7.62 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: Goji</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Class: Goji</h1> <section> <header> <h2> Goji </h2> </header> <article> <div class="container-overview"> <h4 class="name" id="Goji"><span class="type-signature"></span>new Goji<span class="signature">(options)</span><span class="type-signature"> &rarr; {<a href="Goji.html">Goji</a>}</span></h4> <div class="description"> Goji is a template engine inspired by <a href="http://thymeleaf.org/">Thymeleaf</a>. It uses regular HTML as the template "language". </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Complier~Options</span> </td> <td class="description last">Defines the options Goji will use during compilation and rendering</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="goji.js.html">goji.js</a>, <a href="goji.js.html#line15">line 15</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Goji.html">Goji</a></span> </dd> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="compile"><span class="type-signature"></span>compile<span class="signature">(template, options)</span><span class="type-signature"> &rarr; {<a href="Compiler.html#~RenderFunction">Compiler~RenderFunction</a>}</span></h4> <div class="description"> Takes a string template and parses it for includes. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>template</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">An HTML document or snippet</td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type"><a href="Compiler.html#~Options">Compiler~Options</a></span> </td> <td class="description last">Defines the options Goji will use during compilation and rendering. Note: this will overwrite whatever options were specified in the initial constructor.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="goji.js.html">goji.js</a>, <a href="goji.js.html#line32">line 32</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Compiler.html#~RenderFunction">Compiler~RenderFunction</a></span> </dd> </dl> <h4 class="name" id="emptyCache"><span class="type-signature"></span>emptyCache<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Clears Goji's internal cache of templates. Does nothing if you disabled caching. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="goji.js.html">goji.js</a>, <a href="goji.js.html#line40">line 40</a> </li></ul></dd> </dl> <h4 class="name" id="loadTemplateNamed"><span class="type-signature"></span>loadTemplateNamed<span class="signature">(name)</span><span class="type-signature"> &rarr; {string|null}</span></h4> <div class="description"> Looks for a template with the given name in the templates directory (as specified by the <a href="Compiler.html#~Options">Compiler~Options</a>). Once found, the template is read in and returned as a string. This string can then be used with the <a href="Goji.html#compile">Goji#compile</a> method. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">The name of a template. E.g. if you have a template file "foo.html", you would simply provide "foo" as the name</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="goji.js.html">goji.js</a>, <a href="goji.js.html#line55">line 55</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> The template as a string or null if the template could not be found </div> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> | <span class="param-type">null</span> </dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Compiler.html">Compiler</a></li><li><a href="Goji.html">Goji</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.1</a> on Tue Jun 09 2015 14:05:52 GMT-0400 (EDT) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>