Choosing the right UI templating tool - dust.js?

Ed . picture Ed . · Apr 17, 2012 · Viewed 21.1k times · Source

I work on a large Java based web application, it has been built up over the past 5 or so years - the UI needs an overhaul / to be largely re-written. We are investigating the available UI tools/libraries/frameworks to use and have come across dust.js as an option for templating.

The questions: I'm interested in hearing what users of dust.js think of it:

  1. Has it been successful?
  2. Is it easy to use?
  3. Is it sufficiently documented?
  4. Is community support good? (only 6 questions on ST tagged 'dust.js'!)
  5. What are the pros and cons when compared to other templating tools such as Underscore's templating, Google Closure Templates, Handlebars and Mustache.
  6. Are there any problems using it with an MV* structure framework, e.g Backbone.js (online book)?

Some background:

  • Why are we interested in dust.js: The following LinkedIn blog posts first drew our attention to it:

  • Our requirements:

    1. DRY: We ideally want to use the templating system on the server (Java based) and client-side, or just client-side if we opt for LinkedIn's complete approach; Instead of using a JSP, GSP, or ERB to assemble a page server side and send back HTML, we have the server send back just the dynamic data as JSON and have the page assembled in the browser using a static client-side template served from a CDN"
    2. Fully internationalised
    3. Good community support
    4. Sufficiency easy to use / pick up
    5. Works happily with jQuery and Backbone.js
    6. Well documented

Answer

g13n picture g13n · Apr 17, 2012

Dust.js is a good option. It is better than some of the other templating frameworks because it does not constrain that the data should be in a file, or in a string, etc.

Also it is being actively maintained https://github.com/linkedin/dustjs.

  1. Has it been successful?

    Yes, I know at least LinkedIn is using it and also contributing improvements/patches, etc.

  2. Is it easy to use?

    I have tried using it and it is as easy as Mustache or Handlebars.js.

  3. Is it sufficiently documented?

    Yes http://akdubya.github.com/dustjs.

  4. Is community support good? (only 6 questions on ST tagged 'dust.js'!)

    If you are comparing Mustache or Handlebars.js, dust.js does not have as many users, but I believe if you have an issue and post it on the LinkedIn repo they would definitely respond. I will too since I'm watching it :-)

  5. What are the pros and cons when compared to other templating tools such as Underscore's templating, Google Closure Templates, Handlebars and Mustache.

    As for pros, you can check when you should consider using dust.js here https://github.com/linkedin/dustjs#readme.

    As for cons, there aren't enough users for dust.js compared to popular ones like Mustache or Handlebars.js. That said, the other libraries like Google Closure suffer the same problem.

    But like I mentioned before, dust.js is designed very well compared to other frameworks IMHO.

  6. Are there any problems using it with an MV* structure framework, e.g Backbone.js (online book)?

    I have not used it with other MVC frameworks, but I don't think it should be a problem at all.

Hope that helps.