justjohn/twig.js — pull request #195 by Zizaco (2014-12-17 19:02:25+00:00)
Title: Support to twig namespaces / bundle-name

In order to get a better compatibility between twig being used in front-end and in the back-end (with PHP) we've made a fork in order to add "namespace" compatibility.

## Namespace

Para utilizar os namespaces do Twig basta fazer o seguinte. Primeiro defini-los nas _options_ da _task_ no `Gruntfile.js`

...
var template = Twig.twig({
data: breadcrumbTpl,
namespaces: { 'my-namespace': 'path/to/views/' }
}).render();
...

Done this, when referencing another template, instead of using the relative path, it is possible to use the _namespaces_ that were previously defined. Ex:

{# random-template.twig #}
{% extends "kameleon-skin::default.twig" %}
...

The `"my-namespace::"` will now point to `"path/to/views/"`.