Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Conventions, strategy, syntax, file extension for external mustache views/templates?

$
0
0
Just curious what the best, most appropriate methodology is for external mustache template files.  Syntax, loading, rendering etc ...  Just started to test on my own but hoping to kick start the process.

Start with a few basic questions:

File extension?: .html vs .mustache vs.foo
File contents for 'some_template.xyz?': 
  1. <script type="type/template id="mySection">
  2.       <ul>
  3.       {{#items}}
  4.             <li>{{item}}
  5.       {{/items}}
  6. </script>
To render from can?:
  1. el.html( can.view(root/templates/some_template.xyz, items) );
Is it possible to combine multiple external templates into a single external file and access scripts by id?: 
  1. el.html( can.view(root/templates/some_template.xyz#mySection, items) );
  2. el.html( can.view(root/templates/some_template.xyz#anotherSection, otherItems) );
So yeah, just looking for a good guide on working with external mustache templates.  I can't yet introduce Steal.js, so just looking to see what can.view can do.  Thanks!

Viewing all articles
Browse latest Browse all 3491

Trending Articles