After trying many posibilities, i write a piece of code that i need. I have to answer my question because someone can need it. Here is how i collect multiple templates in one external html file and then load them in my script file when i need.
templates.html
<html>
<head>
</head>
<body>
<script type="html/template" id="about">
<h3><%= title %></h3>
</script>
<script type="html/template" id="contact">
<h3><%= title %></h3>
</script>
</body>
</html>
and my script:
$.ajax({
url: "templates.html",
dataType: "html",
async: false,
success: function(data) {
// we have to use "filter" instead of "find", "find" is failing
// we can use underscore's unescape method for &, <, >, "
contactTemplate = _.unescape($(data).filter("#contact").html());
}
});
var AppView = Backbone.View.extend({
el: '#container',
template: _.template(contactTemplate),
initialize: function(){
this.render();
},
render: function(){
this.$el.html(this.template({title: 'Contact'}));
}
});
var appView = new AppView();