I would like to have all Backbone templates in a one single JS file so that I can easily distribute it through CDN. Ideally it should also work with Rails asset compile workflow.
Possible solution #1:
A single JS file with all the templates declared as such:
app.templates.view = " \
<h3>something code</h3> \
";
Too messy. Lack of highlighting.
Possible solution #2:
A single html file with all the templates inline. Include the partial in my master document.
<script type="text/template" id="list-item">
<li><%= item %></li>
</script>
I cannot use the benefit of minified JS file that is distributed through my CDN. The templates will be inline with my HTML file.
Possible solution #3:
Use Require.js but it does not seem to solve the need of including all templates in a single JS file.