Handlebars.Net icon indicating copy to clipboard operation
Handlebars.Net copied to clipboard

Replace built-in helpers

Open cloudfy opened this issue 1 year ago • 1 comments

How to replace built-in block helpers ex. #if. Tried the following:

  var config = new HandlebarsConfiguration()
  {
  };
  config.BlockHelpers.AddOrReplace("if", new IfHelper());
 
  _handlebars = Handlebars.Create(config);
  _handlebars.Configuration.BlockHelpers.AddOrReplace("if", new IfHelper());

does not work as it seems the default handler factory is loaded later and not respecting this.

cloudfy avatar Nov 25 '24 20:11 cloudfy

@cloudfy Did you try to register your helper as described here: https://github.com/Handlebars-Net/Handlebars.Net?tab=readme-ov-file#registering-block-helpers

StefH avatar Mar 06 '25 05:03 StefH