Questions tagged [client-side-templating]
101 questions
385
votes
9 answers
What are the differences between Mustache.js and Handlebars.js?
Major differences I've seen are:
Handlebars adds #if, #unless, #with, and #each
Handlebars adds helpers
Handlebars templates are compiled (Mustache can be too)
Handlebars supports paths
Allows use of {{this}} in blocks (which outputs the current…

Chad Johnson
- 21,215
- 34
- 109
- 207
52
votes
7 answers
Does handlebars.js replace newline characters with
?
Trying to use handlebars.js for templating but the library seems to ignore newlines.
What is the correct way to deal with newlines? Should they be replaced manually after the templating action?

Uri
- 25,622
- 10
- 45
- 72
36
votes
2 answers
Client-side vs. server-side templating (which one?)
I've been reading some very interesting articles about the whole client vs. server rendering lately.…

basickarl
- 37,187
- 64
- 214
- 335
33
votes
4 answers
Django and client-side javascript templates
Intro
I'm currently writing a very standard Django based app (basically a fancy CRM/contact list sort of thing). It's sort of working, but as I keep trying to improve the interface with more and more AJAXy UI code (using jQuery) it's starting to…

Cody Hatch
- 8,857
- 6
- 29
- 36
23
votes
3 answers
Unique ids in knockout.js templates
Suppose I have knockout.js template like this:
If I render this template in…

Roman Bataev
- 9,287
- 2
- 21
- 15
19
votes
2 answers
Basic Example of Client Side Templating with Dust.js
This is my first foray into client-side templating and I want to make sure I'm understanding it and using it correctly. After reading this LinkedIn engineering blog, I decided to go with dust.js rather than mustache or handlebars. Note that this…

dougmacklin
- 2,560
- 10
- 42
- 69
10
votes
1 answer
Client-side templating language with java compiler as well (DRY templating)
I want to be able to define templates once and use them to render html from both the server-side as well as the client-side. (DRY principle and all that)
The API that I'm envisioning is simply this: render(JSON, template) --> html.
I'm using a…

Geert-Jan
- 18,623
- 16
- 75
- 137
9
votes
2 answers
how to use dustjs-linkedin as client side templating?
I get the idea of server and client side templating, but dust.js confuses me a little bit.
In order to use dust.js for client side templating, you need three steps:
complie the template
load the template
render the template
Right?
But where do the…

paynestrike
- 4,348
- 14
- 46
- 70
7
votes
3 answers
How to use precompiled templates in Handlebars with RequireJS?
I'd like to precompile my Handlebars templates, but I'm not sure how this works in development mode.
Is it common practice have some background process like Guard running to constantly monitor changes to Handlebars template files?
I'm using…

Chad Johnson
- 21,215
- 34
- 109
- 207
6
votes
4 answers
Place client-side JavaScript templates in HTML or JavaScript?
Should client-side templates like the following (using underscore's templating engine):
<%= bar %>
be placed in an separate HTML file, or a separate JavaScript file? I know it could work both ways. For example, a JavaScript file…
Qcom
- 18,263
- 29
- 87
- 113
6
votes
4 answers
Client side and Server side rendering of ejs template
I always wanted to learn NodeJS to be able to run the same code on server and client side.
I am using NodeJS with Express and EJS.
So. I have a .ejs page with lot's of HTML, JS, CSS and a small bit with template. For the sake of justice let it be…

Amantel
- 659
- 1
- 8
- 18
6
votes
1 answer
Getting TemplateSyntaxError: unexpected char u'#' on including a Mustache template in html file served by python Google App Engine
I am getting a TemplateSyntaxError: unexpected char u'#' error, when I include a simple Mustache template in my HTML file being served by Python Google App Engine server.
The mustache template that I want to include is:
{{#item}}
{{name}}
…

Nikhil Jindal
- 1,053
- 9
- 10
6
votes
3 answers
Format Numbers and Dates in dust.js (linkedin-fork)
How can i format numbers, currency or date values within a dust.js template?
Data:
{
today: 'Wed Apr 03 2013 10:23:34 GMT+0200 (CEST)'
}
Template:
Today: {today}
Like this way: (with moment.js)Today:…

tiefenb
- 732
- 3
- 16
- 32
6
votes
6 answers
Templating in ClojureScript
I'd like to use ClojureScript to make a "single page" style web app. To that end, I need a client-side templating system. Does anyone have any experience and/or recommendations on which ClojureScript templating systems I should look into? Thanks.

Ari
- 4,121
- 8
- 40
- 56
6
votes
2 answers
Getting the last element from a JSON array in a Handlebars template
So, I found that array elements can be accessed in Handlebars using:
{{myArray.2.nestedObject}} and {{myArray.0.nestedObject}}
..to get the third and first elements for instance. (handlebars-access-array-item)
Is there a way to get the last element…

Sephie
- 331
- 1
- 3
- 15