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 8799773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:24:46+00:00 2026-06-14T00:24:46+00:00

In order to avoid writing JavaScript code that manually generates HTML for dynamic pages

  • 0

In order to avoid writing JavaScript code that manually generates HTML for dynamic pages (which is not only ugly, but not DRY at all), and having simplicity and elegance in mind (as opposed to performance), what are the advantages of using string based templates on the client, such as Mustache.js or Handlebars.js, retrieving json data and templates separately, over using a REST API that retrieves server-side rendered pieces of html?

I was under the impression that client-side templating was the best approach to keep it simple on dynamic pages, but after using it a bit I’m finding that maintaining a page like that is somewhat complex, and its main advantages are better performance and bandwidth usage, which are not generally my primary goals.

  • 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-14T00:24:47+00:00Added an answer on June 14, 2026 at 12:24 am

    I’m currently using Twitter’s Hogan library and before that I was using the Trimpath library. I’m a true believer in client side templating; but they should not be abused. Here is a few arguments:

    1. Just like with server side templates, it helps distinguishing application logic from presentation. Instead of creating a hierarchy of DOM elements manually during run time, defining a template with HTML and rendering it with data from javascript create more readable and elegant code.

    2. I find it practical to have client side templates for repeating hierarchies such as twitter posts, blog entries, news articles, etc… The server only sends the JSON data, (through an AJAX call most of the time), and the data can immediately be bound to the template.

    3. Template engines I have used update innerHTML with the generated HTML string. This is said to be faster than DOM manipulation, but I have never run a benchmark myself.

    4. Desktop applications and RIAs can benefit much from client side templates. They can drive their interfaces without depending on a 3rd party solution.

    5. We can easily have server side templates and client side templates in our projects. They can work together very well. In web projects, I would not recommend we should port our templates to the client side and only send data from the server. For example, I use server side templates with INCLUDE statements to build the entire page. One template can include another template structure to build the interface.
      This is a complicated task for client side templates that will just create unnecessary code and overhead.

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

Sidebar

Related Questions

I am writing a piece of code which is going to order the list
I am writing a program that generates standard alias names per table name. In
I'm writing some code that wraps various content into columns of text (and images,
in order to avoid copy/paste, i can use a unique view for different actions,
In order to avoid soft delete I am creating a recycle bin database. The
I have never written copy constructor, so in order to avoid pain i wanted
I'm updating some properties in a component. In order to avoid missing property errors
Order by descending is not working on LINQ to Entity In the following Query
in order to recover data from server I use XMLHttpRequest and my code is
I was writing a PHP (Kohana) app and I saw that the controller index

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.