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 JST object, so you can use it like this:

  Backbone.View.extend ({Template: JST ['MyTemplateHBS'], render: function () {this. $ El.html (this.template ())}}});   

Of course this is the only way out of many people; I personally like the transformation, which allows me to write code like this:

  backbone. View. Extensions ({Template: Required ('../templates / mytemplate.hbs'), Render: Function () {this. $ El.html (this.template ())}}});    

Comments

Popular posts from this blog

jasper reports - How to center align barcode using jasperreports and barcode4j -

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -