Questions tagged [client-side-templating]

The tag has no usage guidance.

client-side-templating
Filter by
Sorted by
Tagged with
6 votes
1 answer
7k views

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 ...
Nikhil Jindal's user avatar
0 votes
2 answers
348 views

Handbars.js template with top level array

I am having a hard time understanding how to deal with a top level array of dictionaries using handlebars.js with jQuery My data object does not consist of a dictionary with a named array object (...
LJ Wilson's user avatar
  • 14.4k
0 votes
1 answer
110 views

Javascript template parsing in mobile devices

I have implemented basic template parser for javascript. it simply replaces variables within template string. i.e {event.date} will be 7/4/2013 I am using script tag to store template string ...
Rupesh Patel's user avatar
  • 3,025
0 votes
1 answer
2k views

Using data in a handlebars helper

I'm trying to write a Handlebars helper that lets me display an element x number of times, where x is defined in the data passed to the template. I'm adapting the code I found here for #times. But ...
Brad Dwyer's user avatar
  • 6,405
2 votes
2 answers
4k views

One-off rendering of an angular template string

I am writing a directive to integrate SlickGrid with my angular app. I want to be able to configure SlickGrid columns with an angular template (instead of a formatter function). To achieve this, I ...
lukecyca's user avatar
  • 244
7 votes
3 answers
14k views

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 ...
Chad Johnson's user avatar
  • 21.6k
3 votes
2 answers
783 views

Difference between clientside and serverside (ajax) rendering for search page, concerning SEO [closed]

I'm working on a page that is more or less a search tool, it basically consists of an input field, and it will show a list of entries to the user, according to the input. In this situation, if there ...
User's user avatar
  • 32.1k
0 votes
1 answer
163 views

best method to build table headings and data separately using same json in underscore.js?

I'm working on my first site using client-side templating, and so far so good. I'm just looking to achieve the best performance for the code below. I'm given json in this format: [ { "...
Kingsley's user avatar
  • 1,027
1 vote
1 answer
674 views

Installing and using client side templating engines

I am in the process of building a database website. I am currently constructing the various webpages. For my search results, I would like to use a client side templating engine. I have not used one ...
Ben Thompson's user avatar
  • 4,823
2 votes
2 answers
2k views

Templating HTML with hidden state instead of comment or custom script tag

Javascript best practices & conventions, such as those emphasized by John Resig and by Nicholas Zachas, author of book Maintainable JavaScript, suggest using HTML comments or script tags with a ...
Jon Davis's user avatar
  • 6,682
0 votes
1 answer
1k views

How to use a javascript function inside a dust.js template?

I'm using dust.js to do a client side templating. I would like to use a javascript function in my template, the function would get it's argument during templating i.e Ex: mytemplate = " <span> ...
Anirudh's user avatar
  • 125
0 votes
1 answer
472 views

Using just Angular.js templates, without the whole framework?

Is it possible to compile Angular.js templates (ng-show, ng-if, etc) into standalone functions which accept an object and return HTML? Like other templating languages like Handlebars, Underscore.js ...
user1527166's user avatar
  • 3,259
1 vote
1 answer
336 views

Implementing requirejs and client-side templating in existing codeigniter hmvc application

We have been working on a codeigniter hmvc project for quite sometime now and it has grown into a lot of back-end modules and controllers. For the front end we have been applying the regular jQuery ...
mlakhara's user avatar
  • 235
3 votes
2 answers
2k views

Client-side templates in script tags. Advantages/Disadvantages?

Just curious about the current trend to put client-side templates for single-page Java applications in script tags in your HTML file. Seems like an interesting approach, but is this considered a best ...
sma's user avatar
  • 9,537
0 votes
2 answers
52 views

html/javascript: templating options in regular html

Converting a project from django into a flask API backend + backbone.js frontend It was nice to be able to do {% include %} options in the HTML in order to make it more modular, i.e. I was able to ...
fox's user avatar
  • 16k
0 votes
3 answers
232 views

Is there any clean way to grab an HTML template placed in the <head> using jQuery?

Based on Nicholas Zaka's book 'Maintainable JavaScript', I understand that the best way to put a small HTML template in my page is to add something like: <script type="text/x-templates" class="...
Oscar's user avatar
  • 915
6 votes
3 answers
6k views

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: <p>Today: {today} </p> Like this way:...
tiefenb's user avatar
  • 372
2 votes
1 answer
3k views

merge javascript files in directory with node uglify + watch?

Goal: I am trying to build an effortless workflow for client side templating development. Doc Root: /views/uncompiled/ /static/js/compiled/ We start in /views/uncompiled/ This is where I can ...
Dan Kanze's user avatar
  • 18.6k
0 votes
2 answers
2k views

Script tag attributes - javascript

I am trying to understand the basics of templating and have the following problem. When I try to attach ID or/and type attribute to the <script> tag in my HTML code it just doesn't work: <!...
DDEX's user avatar
  • 455
0 votes
2 answers
973 views

Building JavaScript dropdowns based on nested json

Iam trying to build a html from a json object . My json will be in the following structure . [{"Property1":[{"IsDropDown":"true","Value":"Drp1Value1"}, {"IsDropDown":"true","Value":"Drp1Value2"},...
Arun Kumar's user avatar
6 votes
6 answers
1k views

Templating in ClojureScript [closed]

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 ...
Ari's user avatar
  • 4,171
2 votes
1 answer
1k views

Client side vs server side vs Hybrid templating for django backend

I am wondering whether it is worth converting to a more generic templating engine such as mustache or handlebars instead of Django templates. The options I see for myself are: Stay with Django ...
Sid's user avatar
  • 7,581
1 vote
0 answers
15 views

dev server for serving assets with headers

i am trying to serve template assets that can be used like this: <script type="text/x-template" id="todo-item-template" src="todo-item-template.xhtml"> which means i need to set headers on ...
Dustin Getz's user avatar
  • 21.5k
3 votes
1 answer
1k views

using script tags for client side templates, why can't i load via src attribute?

this works fine (am able to access the snippet in the dom by id) <script type="text/x-template" id="todo-item-template"> <div class="todo-view"> {blah} {blah} </div> </...
Dustin Getz's user avatar
  • 21.5k
9 votes
2 answers
8k views

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 ...
paynestrike's user avatar
  • 4,508
4 votes
1 answer
655 views

Handlebars - get unaltered content of block

I'd like to get the un-altered/un-rendered/whatever content of a block in handlebars. So, let's say I've got the following: {{#template}} <tr><td>{{name}}</td><td>{{price}}...
Stephen's user avatar
  • 5,370
4 votes
2 answers
1k views

pre-compiling javascript templates

After reading What are the differences between Mustache.js and Handlebars.js? I was puzzled with a question: What does pre-compiling of javascript templates means? Previously I was using a simple ...
Salvador Dali's user avatar
0 votes
2 answers
521 views

Filling image source urls in client side javascript templates using ajax requests

I am trying to use client side templating library dust.js. I want to fill the "src" attribute of "img" tag ({profile.picUrl} in the code) using a value retrieved from the server using Ajax(in Json ...
Anvesh's user avatar
  • 395
3 votes
1 answer
1k views

What are the advantages of client-side templating (mustache-like)

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 ...
Facundo Olano's user avatar
53 votes
7 answers
39k views

Does handlebars.js replace newline characters with <br>?

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's user avatar
  • 26.3k
0 votes
1 answer
2k views

Disable checkbox in Telerik Grid in MVC

Is it possible to DISABLE a Checkbox in the Telerik gridview in MVC pattern? I am using clientTemplate and not Server side. The requirement is as - A Column containing checkbox needs to be disabled ...
Bharathi's user avatar
  • 1,015
3 votes
1 answer
4k views

How to save username and password in client side templating application

I am writing a web application using client side templating. This application needs to interact with a REST Server which supports Basic Http authentication (using ssl). So, with every request that ...
db42's user avatar
  • 4,514
2 votes
1 answer
1k views

How to embed raw html string attribute into .hamlc template?

Currently I have backbone RIA with rails backend. I'm using haml_coffee_assets gem for client-side templating. But I miss rails view helpers there. I decided to add raw html strings into my backbone ...
Ortepko's user avatar
  • 371
3 votes
0 answers
2k views

Rendering HTML (and CSS) offscreen for advanced templates

I'm building a Javascript-based client side templating engine for an internal app. It loads HTML/CSS-based templates from the server and combines them with HTML-based contant (P, EM, etc.) The ...
Michael's user avatar
  • 1,762
1 vote
4 answers
2k views

Way to organize client-side templates into individual files?

I'm using Handlebars.js, and currently all my templates live inside script tags which live inside .html files housing dozens of other templates, also inside script tags. <script type="text/...
Chad Johnson's user avatar
  • 21.6k
6 votes
2 answers
7k views

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-...
Sephie's user avatar
  • 331
0 votes
1 answer
190 views

Client-side vs server-side templating for large enterprise applications

What makes most sense for large enterprise applications involving several jsps and many transactions (like a commercial banking application or a healthcare application with huge amounts of data) w.r.t ...
Ramya's user avatar
  • 289
388 votes
9 answers
152k views

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 ...
Chad Johnson's user avatar
  • 21.6k
4 votes
3 answers
3k views

Mustache-like templating language with extends?

I like the minimal-ness of mustache-style templating languages - I'm currently using mustache and icanhasmustache, but I've also checked out handlebars and hogan. However I have a need to for an '...
mikemaccana's user avatar
2 votes
2 answers
392 views

Render views without any controller in Play

I am building an application using Play for Model and Controller, but using backbone.js, and client side templating. Now, I want the html templates to be served by Play without any backing controller. ...
Shreyas's user avatar
  • 1,462
4 votes
2 answers
2k views

Implementing a cycle tag in Handlebars.js

In Django there is a template tag called cycle: https://docs.djangoproject.com/en/2.2/ref/templates/builtins/#cycle An example: {% for o in some_list %} <tr class="{% cycle 'row1' 'row2' %}"&...
hekevintran's user avatar
  • 23.3k
2 votes
2 answers
244 views

Client side templating and search engine referencing

I keep hearing about javascript templating engines like knockoutjs or backbone recently. They all seem pretty cool but I was wondering if using such systems prevents good indexing of web pages. Are ...
Benjamin Brizzi's user avatar
23 votes
3 answers
21k views

Unique ids in knockout.js templates

Suppose I have knockout.js template like this: <script type="text/html" id="mytemplate"> <label for="inputId">Label for input</label> <input type="text" id="inputId" data-...
Roman Bataev's user avatar
  • 9,345
33 votes
4 answers
14k views

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 ...
Cody Hatch's user avatar
  • 8,887
4 votes
2 answers
3k views

Illustrator/SVG to JavaScript workflow? (A templating library?)

When "Saving as SVG" in Illustrator, this is the typical result: <?xml version="1.0" encoding="iso-8859-1"?> <!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 ...
dani's user avatar
  • 4,990
6 votes
4 answers
3k views

Place client-side JavaScript templates in HTML or JavaScript?

Should client-side templates like the following (using underscore's templating engine): <p class="foo"><%= bar %></p> be placed in an separate HTML file, or a separate JavaScript ...
Qcom's user avatar
  • 18.7k
10 votes
1 answer
2k views

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: ...
Geert-Jan's user avatar
  • 18.8k
1 vote
2 answers
346 views

client-side templating

Its been a while since i am working with the AJAX and getting templates from server-side hence creating huge traffic. Fetching same HTML on single page with only different data, sometimes i feel ...
Imran Naqvi's user avatar
  • 2,212
2 votes
1 answer
468 views

Using .data() method in jQote – client-side templating plugin

For the past few weeks, i have been using jQote – client-side templating plugin to generate html fragments in runtime. For months i have been using the dom attributes like, id, class, alt to store ...
user avatar

1
2