Skip to content

Custom Handlebars Partials Support #1238

Description

@corentinaltepe

Azure DevOps Extensions

Generate Release Notes (Node Cross Platform)

Is your feature request related to a problem? Please describe.

Hello. Does the Generate Release Notes tool support importing custom Handlebars Partials? I see from documentation that we can import a custom handlebars helpers with the configuration keys customHandlebarsExtensionCode, and customHandlebarsExtensionFile.

I'd be interested in a similar feature enabling import of custom partials. That would greatly reduce code repetition in our templates.

Describe the solution you'd like

As far as I understand, I'd say add the 2 optional configuration keys:

  • customHandlebarsPartialsCode
  • customHandlebarsPartialsFile

In ReleaseNotesFunctions.ts, call to handlerbars.registerPartials(). I suspect we need to do something close to these lines.

Describe alternatives you've considered

Following documentation on using custom handlebars extensions, I tried importing my own handlebars and registering my custom partials myself. But that didn't work.

// customExtension.js
/** Handlebars extensions helping with generating TES' release notes. */
const handlebars = require("handlebars");
handlebars.registerPartials("mypartial", "{{my_custom_extension}}");

module.exports = {
  my_custom_extension() {
     // ...
  },
};

Console output:

##vso[task.debug]Attempting to load custom handlebars extension from xxxhandlebarsExtensions.js}
Loaded handlebars extension file
##vso[task.issue type=error;]Error Processing handlebars [Error: The partial mypartial could not be found]

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions