Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Handlebars Partials Support #1238

Open
corentinaltepe opened this issue Feb 17, 2022 · 1 comment
Open

Custom Handlebars Partials Support #1238

corentinaltepe opened this issue Feb 17, 2022 · 1 comment

Comments

@corentinaltepe
Copy link

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

@rfennell
Copy link
Owner

I can't see a reason not to add the feature looks useful. I am not sure when I will get around it, but it is on the backlog

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

No branches or pull requests

2 participants