Skip to content

Latest commit

 

History

History
73 lines (54 loc) · 2.27 KB

README.md

File metadata and controls

73 lines (54 loc) · 2.27 KB

LPSC      IN2P3      UGA      CERN      CERN

AMI-TWIG.js

AMI-TWIG.js is a JavaScript implementation for both NodeJS and browsers of the SensioLabs's TWIG template engine.

Getting started

Loading AMI-Twig.js server-side:

let amiTwig = require('ami-twig.min.js').amiTwig;

Loading AMI-Twig.js client-side:

<script type="text/javascript" src="ami-twig.min.js"></script>

Using AMI-Twig.js:

let textResult = amiTwig.engine.render(twigTemplate, optionalDict, optionalTwigTemplates);

where optionalDict contains all the global variables for the template.

For optimization perposes, templates can be compiled before rendering:

let compiledTemplate = amiTwig.engine.compile(twigTemplate);

let textResult = amiTwig.engine.render(compiledTemplate, optionalDict, optionalTwigTemplates);

Developers