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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:18:49+00:00 2026-06-03T04:18:49+00:00

dust.js is an asynchronous javascript template engine — you pass a callback to the

  • 0

dust.js is an asynchronous javascript template engine — you pass a callback to the “render” function.

CouchDB “show” functions, on the other hand, must actually return the HTML.

So I can’t use dust.js in my show function!…it just won’t work.
How can I get around this synchronous/asyncronous problem?

EDIT:
I should be able to do it by using the (asynchronous) “send” function:

function(doc,req){
    var dust = require('lib/dust');
    dust.renderSource('Hello, my name is {name}',{name:'Nick'},function(err,output){
        send(output);
    });
}

..but that is not working, I get this:

{"error":"render_error","reason":"function raised error: (new TypeError(\"dust.compile is not a function\", \"\", 37)) \nstacktrace: (\"Hello, my name is {name}\")@:37\n(\"Hello, my name is {name}\",[object Object],(function (err, output) {send(output);}))@:33\n([object Object],[object Object])@:2\napply([object Object],[object Array])@:0\nrunShow(function (doc, req) {var dust = require(\"lib/dust\");dust.renderSource(\"Hello, my name is {name}\", {name:\"Nick\"}, function (err, output) {send(output);});},[object Object],[object Array])@/usr/share/couchdb/server/main.js:886\n(function (doc, req) {var dust = require(\"lib/dust\");dust.renderSource(\"Hello, my name is {name}\", {name:\"Nick\"}, function (err, output) {send(output);});},[object Object],[object Array])@/usr/share/couchdb/server/main.js:989\napply(null,[object Array])@:0\n(\"_design/ibs_policies\",[object Array],[object Array])@/usr/share/couchdb/server/main.js:1401\napply(null,[object Array])@:0\n()@/usr/share/couchdb/server/main.js:1443\n@/usr/share/couchdb/server/main.js:1454\n"}

It seems that “dust.js” is not exposing all of it’s functions when imported as a CommonJS module?
Why is that?
How can I make this work?

  • 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-03T04:18:50+00:00Added an answer on June 3, 2026 at 4:18 am

    Just based on a preliminary look at dust’s source, it seems to be expecting to find some nodejs-specific stuff if it’s not running in a browser. In particular, it looks like dust.compile is only exported from code that’s only called if process is defined and window isn’t. Neither will be defined when running under CouchDB’s view engine.

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

Sidebar

Related Questions

I'm using Sinatra and a client-side template called Dust.js (akin to Mustache) to build
Dust me selectors is installed but cant find anyway of saving the css minus
I've been searching and i can't find any ff addons or javascript for finding
I know there is an extension called Dust-Me Selectors for Firefox and also that
I get to dust off my VBScript hat and write some classic ASP to
I've recently had to dust off my Perl and shell script skills to help
I'm returning to c++ after being away for a bit and trying to dust
Many applications accumulate binary dust -- records that were accumulated over time and will
I have an old computer with formatted drive lying around collecting dust, now I
I have an old demo project I am trying to dust off to run

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.