Logic

The Dust core logic helpers provide basic logic for templates that most apps will need. The helpers include logical comparisons (equal, less than, greater than), simple math operations, and more.

Although Dust is not completely logicless, so that you can get around some basic hurdles, it is still wise not to bloat templates with too much “business logic.” If there’s too much logic in a Dust template, it will be hard to read and hard to maintain. This will just increase the difficulty of maintaining your template. Let the server handle the business logic, or write context helpers to move logic out of your templates.

Debugging

Debugging can be turned on by setting dust.debugLevel to “DEBUG”, “INFO”, “WARN”, or “ERROR” before you render the template.

if (process.env.NODE_ENV === 'development') {
  dust.debugLevel = "INFO";
}

When running a Node app via the command line, you can set the environment variable DEBUG to dust to automatically turn on debugging.

$ DEBUG=dust node app.js

Linting

You can run Swiffer, the Dust linter, to get warnings about possible security holes, parse errors, and coding-style guidelines.


Fork me on GitHub