Reputation: 407
Im working on an ASP.NET MVC web application in which we are using Backbone.js framework for organizing client side architecture and design. Our application is totally dynamic, creating most of the parts dynamically. We are using underscore templates to create HTML. As the project size is increasing , the underscore JS templates are piling up.
I need suggestion about: is there a better way to create dynamic HTML content through Backbone views without using underscore templates? Are the underscore templates the best solution in most circumstances? What are the alternative approaches to render backbone views?
Thanks,
Upvotes: 0
Views: 92
Reputation: 538
We started with underscore templates since they came with Backbone, but as the app grew we did two things.
First we switched to Handlebars, this made the templates more readable and gave us less logic in the templates. If you need any complex logic chances are its better to create a Backbone subview or wrap the logic in a Handlebars helper.
The second thing we did was to reorganize our files to keep the templates with the views and organize them in folders based on app structure. This made it easier to find the right template.
Upvotes: 2