I used to be able to store a JSRender template in formatted text in a html file and stored on server. Then I used $.get to retrieve my template and render.
My helper method is similar to: Store a jsRender template in a separate js file:
function LoadJSRenderTemplate(container, templateUrl, myArray) {
$.when($.get(templateUrl))
.done(function(tmplHtml) {
$.templates({ MyTemplate: tmplHtml });
container.html($.render.MyTemplate(myArray));
});
}
My template looks like the following:
<div class="ResultTableRow">
<span>{{>Distributor}}</span>
{{if FuelType}}
<span>
{{for FuelType}}
{{>#data}}<br />
{{/for}}
</span>
{{/if}}
</div>
Today I started another project and use the latest jsrender suddenly the same technique stopped working...urrr. Now I have to compress my easy-to-read template into an one-liner js file following this http://www.jsviews.com/#samples/jsr/composition/remote-tmpl sample. Although it works, but I hate to have to lose the easiness in reading the indented template format I was so used to.
Why? And what changed?