index.js
function buildTemplate(filename, options, callback) {
  var isAsync = callback && typeof callback === 'function',
      getTemplateContentFn = options.getTemplate  && typeof options.getTemplate === 'function' ? options.getTemplate : getTemplateContentFromFile;

  // sync
  if (!isAsync) {
    return builtTemplateFromString(
        getTemplateContentFn(filename, options),
        filename,
        options
    );
  }

  // function to call when retrieved template content
  function done(err, templateText) {
    callback(err, builtTemplateFromString(templateText, filename, options));
  }

  getTemplateContentFn(filename, options, done);
}
function buildTemplate(filename, options, callback) {
  var isAsync = callback && typeof callback === 'function',
      getTemplateContentFn = options.getTemplate  && typeof options.getTemplate === 'function' ? options.getTemplate : getTemplateContentFromFile;

  // sync
  if (!isAsync) {
    return builtTemplateFromString(
        getTemplateContentFn(filename, options),
        filename,
        options
    );
  }

  // function to call when retrieved template content
  function done(err, templateText) {
    callback(err, builtTemplateFromString(templateText, filename, options));
  }

  getTemplateContentFn(filename, options, done);
}
function buildTemplate ( filename , options , callback ) { var isAsync = callback && typeof callback === 'function' , getTemplateContentFn = options . getTemplate && typeof options . getTemplate === 'function' ? options . getTemplate : getTemplateContentFromFile ; // sync if ( ! isAsync ) { return builtTemplateFromString ( getTemplateContentFn ( filename , options ) , filename , options ) ; } // function to call when retrieved template content function done ( err , templateText ) { callback ( err , builtTemplateFromString ( templateText , filename , options ) ) ; } getTemplateContentFn ( filename , options , done ) ; }
Builds a template
If callback is passed, it will be called asynchronously.
@param {String} filename The path or the name to the template
@param {Object} options The options sent by express
@param {Function} callback (Optional) The async node style callback
Builds a template If callback is passed it will be called asynchronously .