Permalink
Browse files

Deprecate #IfAny since #if works just as well.

The only usage in kss-node was {{#ifAny markup modifiers}} and, since modifiers
is an object and, always evals to true (even when empty), #ifAny was effectively
a dupe of Handlebars' built-in #If.
  • Loading branch information...
JohnAlbin committed Jul 18, 2014
1 parent 6f42627 commit e960b368a2d9a8ca2b09559f4b2777baa4c943ce
Showing with 7 additions and 2 deletions.
  1. +5 −0 bin/kss-node
  2. +2 −2 lib/template/index.html
View
@@ -326,6 +326,11 @@ handlebars.registerHelper('ifAny', function() {
success = true,
i;
+ // Warn the user that IfAny is deprecated. The only usage in kss-node was
+ // {{#ifAny markup modifiers}} and, since modifiers is an object and, always
+ // evals to true (even when empty), #ifAny was effectively a dupe of #If.
+ console.log('IfAny is deprecated; if your template has {{#ifAny markup modifiers}}...{{/ifAny}}, replace it with {{#ifAny markup}}...{{/if}}.');
+
for (i = 0; i < numItems; i += 1) {
if (!arguments[i]) {
success = false;
View
@@ -55,7 +55,7 @@ <h1 class="kss-title"><span class="kss-ref">{{ reference }}{{#whenDepth 1}}.0{{/
<div class="kss-box">{{html description}}</div>
{{/if}}
- {{#ifAny markup modifiers}}
+ {{#if markup}}
<table class="kss-mod-list">
<tr class="kss-mod-desc-group">
<td class="kss-mod-desc"><p>Default styling</p></td>
@@ -78,7 +78,7 @@ <h1 class="kss-title"><span class="kss-ref">{{ reference }}{{#whenDepth 1}}.0{{/
<div class="kss-markup">
<pre class="prettyprint lang-html">{{markup}}</pre>
</div>
- {{/ifAny}}
+ {{/if}}
{{#whenDepth 1}} {{else}}
</section>

0 comments on commit e960b36

Please sign in to comment.