title: Backbone templates in production
body: <p>From <a href="https://github.com/ccoenraets/backbone-jax-cellar/blob/master/WebContent/js/utils.js" rel="nofollow">https://github.com/ccoenraets/backbone-jax-cellar/blob/master/WebContent/js/utils.js</a>:</p>
  
  <pre><code>tpl = {
  
  // Hash of preloaded templates for the app
  templates: {},
  
  // Recursively pre-load all the templates for the app.
  // This implementation should be changed in a production environment. All the template files should be
  // concatenated in a single file.
  loadTemplates: function(names, callback) {
  
      var that = this;
  
      var loadTemplate = function(index) {
          var name = names[index];
          console.log('Loading template: ' + name);
          $.get('tpl/' + name + '.html', function(data) {
              that.templates[name] = data;
              index++;
              if (index &lt; names.length) {
                  loadTemplate(index);
              } else {
                  callback();
              }
          });
      }
  
      loadTemplate(0);
  },
  
  // Get template by name from hash of preloaded templates
  get: function(name) {
      return this.templates[name];
  }
  };
  </code></pre>
  
  <p>Should I do something like</p>
  
  <pre><code>$.get('tpl/all-tpls.html', function(data) { }
  </code></pre>
  
  <p>to get all the html templates? Wouldn't that be unnecessarily fetching a bunch of html? Our app is being built in Java and we are using <a href="https://github.com/samaxes/minify-maven-plugin" rel="nofollow">https://github.com/samaxes/minify-maven-plugin</a> to minify and combine our js and css files. Any direction would be appreciated.</p>