Skip to content Skip to sidebar Skip to footer

Integrating ICanHaz And Marionette

I'm a big fan of ICanHaz, and I'm trying to directly intregrate it into a new Marionette application I'm building. However, going off this post, I have written this that reaches in

Solution 1:

Okay, I couldn't find an easy way to do this using ICH. However, due to another SO I found, very similar functionality can be found just using Mustache.

Using this code:

 Backbone.Marionette.TemplateCache.prototype.compileTemplate = function(rawTemplate) {
    return Mustache.compile(rawTemplate);
 }

Lets you change the renderer so you can pull mustache templates from index.html using Marionette's template call. A mustache template looks like this:

 <script id="headerTemplate" type="text/template">
        <p>{{user_name}}</p>
        <p>{{tenant}}</p>
    </script>

The difference is that the type is 'text/template' as opposed to 'text/html'. Otherwise it acts very similar.

Hope this helps someone else.


Post a Comment for "Integrating ICanHaz And Marionette"