Templates avec Twig JS
../marionette/template/LosPollosHermanos/Lab.twig:
{% twig_js name="LosPollosHermanos_Lab" %}
Los Pollos Hermanos best meth lab
Surface: {{ lab.surface }}
Modification des assets:
'../vendor/jms/twig-js/twig.js'
{% javascripts %}
'../marionette/template/LosPollosHermanos/Lab.twig'
output='js/templates.js' filter="twig_js"
%}
{% endjavascripts %}
../marionette/view/LosPollosHermanos/Lab.js:
App.View.LosPollosHermanos.Lab = Marionette.View.extend({
tagName: 'div',
// template: '
Los Pollos Hermanos best meth lab
',
template: LosPollosHermanos_Lab,
render: function() {
// this.$el.html(this.template);
this.$el.html(Twig.render(this.template, {'lab': {'surface': 20 }}));
return this;
}
});