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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:13:21+00:00 2026-06-15T21:13:21+00:00

I get the idea of server and client side templating, but dust.js confuses me

  • 0

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:

  1. complie the template
  2. load the template
  3. render the template

Right?

But where do the templates come from? I saw two different methods:

 1. <script> template <script>
 2. <div> template </div>

… Both of them are in the DOM. Which is correct?

I also notice that you can load the template via ajax, so the template won’t be seen in the DOM, but I don’t know how to do that.

Also, I’m currently using jade as express view engine. Is it necessary to switch to dust.js? What is the advantage?

  • 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-15T21:13:23+00:00Added an answer on June 15, 2026 at 9:13 pm

    This is LinkedIn Dust JS wiki page that can answer your questions and has very good examples: http://linkedin.github.com/dustjs/

    But to answer your questions here:

    Yes you need to compile your dust template which becomes a JavaScript file that you can add to your page by <script> tag and then call dust.render method to render your template. Here is an example:

    1. write following code in a template file and save it as sample.tl

      <p>Hi {firstName} {lastName}</p>
      
    2. compile sample.tl to sample.js by dustc sample.tl in command line or use dust.compile("your_template_code", "template_name") to compile the template and save the output in a JavaScript file (sample.js) or you use duster.js to watch and compile templates by nodejs: https://github.com/dmix/dusterjs

    3. add sample.js in your html:

      <script type="text/javascript" src="sample.js"></script>
      

      this will also register your template to dust.cache.

    4. in your JavaScript:

      var your_json = {firstName:'James', lastName:'Smith'};
      
      dust.render('sample', your_json, function(err, out){
      
          your_dom_element.innerHTML = out;
      
      });
      

      The result of above dust.render method will be <p>Hi James Smith</p>

      So you need to pass 3 arguments to dust.render: dust.render(template_name, json, callback)

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

Sidebar

Related Questions

I get the following Nhiberante error, but have no idea why: could not execute
I am using Restlet FileRepresentation to get a file on the server side of
I have a Java-based server side and a flex client side using Spring BlazeDS
I have a client side that sends a request that need long processing time,
May i achieve that server side application (using android bluetooth API)connect to particular client
I like the idea of extending on the client side classes that are data
Using Meteor, I'm attempting to understand when to use server-side Meteor.methods() while still retaining
I'm trying to lay out an idea for a project, where a client-side GUI
I'd like to use PlayN to create a client/server card game, e.g. Hearts. While
I need to create wcf service for sharepoint 2010. The idea to use Jquery

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.