Context helpers that extend the core Dust.js templating system with conditional logic, mathematical operations, and iteration utilities.
Utility and debug helpers that provide debugging capabilities and utility operations for template development and maintenance.
Helper for debugging template contexts by outputting context information in various formats.
/**
* Context dump helper - outputs context data for debugging
* @param key - "full" for complete context stack, otherwise current context (optional)
* @param to - "console" to log to console, otherwise outputs to template (optional)
*/
{@contextDump key="full|current" to="console|template"/}Usage Examples:
// Dump current context to template
{@contextDump/}
<!-- Outputs JSON representation of current context -->
// Dump full context stack to template
{@contextDump key="full"/}
<!-- Outputs complete context stack as JSON -->
// Log current context to console
{@contextDump to="console"/}
<!-- Logs to console, no template output -->
// Log full context stack to console
{@contextDump key="full" to="console"/}
<!-- Logs complete stack to console -->
// Debug specific template section
<h2>User Profile</h2>
{#user}
<p>Name: {name}</p>
<p>Email: {email}</p>
<!-- Debug the current user context -->
{@contextDump to="console"/}
{/user}
// Debug in development environment
{@select key="{env}"}
{@eq value="development"}
<details>
<summary>Debug Context</summary>
<pre>{@contextDump/}</pre>
</details>
{/eq}
{/select}Output Format:
The context dump is JSON-formatted with special handling for functions:
Context Types:
Legacy helper for resolving dust references (deprecated, use native dust resolution instead).
/**
* Tap helper - resolves dust references (DEPRECATED)
* @param input - Value or reference to resolve
* @deprecated Use native Dust context resolution instead
* @removal_version 1.8
*/
{@tap}{reference_to_resolve}{/tap}Migration Examples:
// OLD (deprecated, will be removed in v1.8)
{@tap}{user.profile.name}{/tap}
// NEW (use native Dust resolution)
{user.profile.name}
// OLD (deprecated)
{@tap}{#items}{name}{/items}{/tap}
// NEW (native Dust iteration)
{#items}{name}{/items}
// OLD (deprecated with complex references)
{@tap}{user.settings[0].value}{/tap}
// NEW (native resolution)
{user.settings[0].value}Deprecation Warning:
The @tap helper generates deprecation warnings when used:
_deprecated() function that tracks already shown warnings// Debug only in development mode
{@eq key="{debug}" value="true"}
<div class="debug-panel">
<h3>Template Debug Info</h3>
<h4>Current Context:</h4>
<pre>{@contextDump/}</pre>
<h4>Full Stack:</h4>
<pre>{@contextDump key="full"/}</pre>
</div>
{/eq}
// Debug specific data sections
{#products}
<div class="product">
<h3>{name}</h3>
{@contextDump key="current" to="console"/}
{@select key="{debug}"}
{@eq value="verbose"}
<small>Debug: {name} | Price: {price} | Stock: {stock}</small>
{/eq}
{/select}
</div>
{/products}// Log context size for performance monitoring
{@size key="{data}"}
{@contextDump to="console"/}
<!-- Log context when data size exceeds threshold -->
{@gt value="1000"}
{@contextDump key="full" to="console"/}
{/gt}
{/@size}
// Debug missing data
{@contextDump key="current" to="console"/}
{@select key="{user}"}
{@none}
<!-- Log context when user is missing -->
{@contextDump key="full" to="console"/}
<p>User data not available</p>
{/none}
{/select}Security Considerations:
@contextDump with template output in productionto="console" parameter for production debuggingBest Practices:
@contextDump primarily during development and testingInstall with Tessl CLI
npx tessl i tessl/npm-dustjs-helpers