-
Notifications
You must be signed in to change notification settings - Fork 70
Deprecated Features
Deprecation warnings in the Dust logs link here. You can find information on what features are deprecated, along with suggestions for how to replace those features in your Dust templates.
Deprecated in: 1.5.0
Removed in: 1.6.0
Deprecated because: {@if}
uses eval()
internally, which greatly impacts both the speed at which your template can be rendered as well as the security of your application. In addition, using this helper allows template authors to inject considerable amounts of logic into their template, which goes against the philosophy of Dust.
Alternatives: You can replace many {@if}
statements with the comparison helpers {@eq}
, {@lt}
, and {@gt}
. These helpers can also be nested to check multiple conditions. For more complex comparisons, move the logic from your template to a context helper-- a function contained in your Dust context.
{@if cond="{x} < {y} && {b} == {c}"}The system is down{/if}
{! replace with: !}
{@lt key=x value=y}
{@eq key=b value=c}
The system is down
{/eq}
{/lt}
{@if cond="{x} && ('{y}'.length < {z})"}The system is down{/if}
{! replace with: !}
{#systemDown}The system is down{/systemDown}
{! in your context: !}
{
"systemDown": function(chunk, context) {
var x = context.get('x'),
y = context.get('y'),
z = context.get('z');
return (x && y.length < z);
},
...
}
Deprecated in: 1.5.0
Removed in: 1.6.0
Deprecated because: this helper function has been replaced by a Dust built-in grammar feature.
Alternatives: Replace uses of this helper with {$idx}
. This feature does not require dustjs-helpers
at all.
{#list}
{@idx/}. {.}
{/list}
{! replace with !}
{#list}
{$idx}. {.}
{/list}