title: How can I register and use a Handlebars helper with Node?
body: <p>I'm using Handlebars with Node, and that works fine:</p>
  
  <pre><code>require('handlebars');
  var template = require('./templates/test-template.handlebars');
  var markup = template({ 'some': 'data' });
  console.log(markup);
  </code></pre>
  
  <p>That works fine. However, I need to register and use a custom helper in my template. So, now my code looks like this:</p>
  
  <pre><code>var Handlebars = require('handlebars');
  
  Handlebars.registerHelper('ifEqual', function(attribute, value) {
      if (attribute == value) {
          return options.fn(this);
      }
      else {
          return options.inverse(this);
      }
  });
  
  var template = require('./templates/test-template.handlebars');
  var markup = template({ 'some': 'data' });
  console.log(markup);
  </code></pre>
  
  <p>But now when I run my script, I get</p>
  
  <blockquote>
    <p>Error: Missing helper: 'ifEqual'</p>
  </blockquote>
  
  <p>So: how can I define and use a custom helper in Node?</p>