backbone.js - Backbone / Handlebars template organization / including -
I am making a backboneJS / handlabsjs single page project and I am a small part of a knot with the spinal cord (I normally use) AngularJS). I want to put each template (headers, sidebar, footer, content) in different files for the organization.
I have read some posts that say that you should put the template in separate files for development and then combine them into a file for production. I am pretty sure they have .html files And I'm not sure what tool they get mixed up.
How to load correct templates from files? And do I add files to one and import it? Is it easy to have a tool? If you have a tutorial that describes the proper framework which will be great. Please thank you! Handlar templates are usually sent in the compiled (= JavaScript) form, which makes the display a bit She goes. To do this properly, it makes great sense to use a construction tool and work. It creates a javascript file out of all templates and, by default, stores the templates in the global Of course this is the only way out of many people; I personally like the transformation, which allows me to write code like this: JST object, so you can use it like this:
Backbone.View.extend ({Template: JST ['MyTemplateHBS'], render: function () {this. $ El.html (this.template ())}}});
backbone. View. Extensions ({Template: Required ('../templates / mytemplate.hbs'), Render: Function () {this. $ El.html (this.template ())}}});
Comments
Post a Comment