Skip to content

Cannot compile empty template for partial #675

Closed
@ghost

Description

When trying to run a template referring to an empty partial template (Handlebars.compile('')) in Handlebars 1.1.2, I get the following error:

Uncaught Error: You must pass a string or Handlebars AST to Handlebars.compile. You passed function (context, options) {
      if (!compiled) {
        compiled = compileInput();
      }
      return compiled.call(this, context, options);
}

I'm using partials applied at template run time (through the partials: option), not globals:

var myPartial = Handlebars.compile( '' ),
     myTemplate = Handlebars.compile( '{{> myPartial}}' );

console.log( myTemplate( {}, { partials: { myPartial: myPartial } } );

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions