JSFiddle - React, Tailwind, and code Playground
by Eric Howe
HTML
<script src="http://documentcloud.github.com/underscore/underscore-min.js"></script>
<script src="http://documentcloud.github.com/backbone/backbone-min.js"></script>
<div id="view-goes-here"></div>
<script id="t" type="text/x-underscore-template">
<p>Pancakes!</p>
</script>
CSS
#view-goes-here {
padding: 50px;
border: 1px solid black;
}
JavaScript
var V = Backbone.View.extend({
initialize: function() {
if(!this.constructor.prototype.t) {
this.constructor.prototype.t = _.template($('#t').html());
console.log('compile');
}
},
render: function() {
this.$el.html(this.t());
return this;
}
});
$('#view-goes-here').append(new V().render().el);
$('#view-goes-here').append(new V().render().el);