Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8240703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:34:53+00:00 2026-06-07T20:34:53+00:00

Currently in a Backbone project I am working on, I have combined all templates

  • 0

Currently in a Backbone project I am working on, I have combined all templates by modules. Something like:

  • users.html
    • #profileTemplate
    • #changePasswordTemplate
    • …
  • something.html
    • #someTemplate
    • #anotherTemplate

Then I load templates by modules as required with $.get. I am intending to use Backbone Marionette to load these templates and the suggested method is: link

Backbone.Marionette.TemplateCache.loadTemplate = function(templateId, callback){
  var that = this;
  var url = templateId + ".html";

  $.get(url, function(templateHtml){
    var template = $(templateHtml).find(templateId);
    callback(template);
  });
}

This will mean I have to break my templates down into even more files, meaning alot more network requests. I wonder whats the recommended way of doing this? Combine everything into 1 big file or many small files or somewhere in between by modules? If by modules then I will need to add a parameter to loadTemplate(moduleUrl, templateSelector, callback) havent tried that, will do that tomorrow, but is that recommended even if it does not break anything? I am overriding a 3rd party framework method and worse, changing its method signature? What the recommended solution then?

Maybe since I am using RequireJS, my templates can be loaded via Require?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T20:34:55+00:00Added an answer on June 7, 2026 at 8:34 pm

    I wonder whats the recommended way of doing this?

    the recommended way is to not load files asynchronously. load everything you need all at once, right away, whenever possible.

    “Async does not make things go fast. Async is what you do when you CAN’T make something go fast enough.” – https://twitter.com/izs/status/216954021926285313

    Maybe since I am using RequireJS, my templates can be loaded via Require?

    Yes.

    Let RequireJS optimize your template by pre-compiling them, and concatenating them in to your app’s file w/ the r.js plugin. This will significantly improve the performance of your app.

    …

    In the off-chance that you really do need to do async loading of templates and modules, group things in to the smallest number of files possible the way you have been thinking. You would need to modify the code you referenced to handle this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have two Backbone models: user and project. I would like to have
I'm currently working with backbone.js and I have a strange problem : I have
I'm currently diving into Backbone.js, and working on a few complex web apps. I've
Currently I'm working on a Server-Client system which will be the backbone of my
I have a rails 3.1 project that I'd like to run some jasmine specs
I have zero experience with Backbone.js currently, and before I start having a good
I have a web application that is currently using backbone.js 0.5.3 with backbone local
I have a backbone project that pulls podcasts from verious API's. The issue I
Currently I am using backbone-rails in my Rails app. I would like to know
I've been experimenting with Backbone for a project I'm working on, and I've been

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.