Skip to content

Commit

Permalink
fix: register partials in handlebars (#715)
Browse files Browse the repository at this point in the history
  • Loading branch information
Diptesh Choudhuri committed Dec 30, 2021
1 parent 2399294 commit 7f2cbae
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/adapters/handlebars.adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,17 @@ export class HandlebarsAdapter implements TemplateAdapter {

if (runtimeOptions.partials) {
const files = glob.sync(path.join(runtimeOptions.partials.dir, '*.hbs'));
files.forEach((file) =>
precompile(file, () => {}, runtimeOptions.partials),
);
files.forEach((file) => {
const { templateName, templatePath } = precompile(
file,
() => {},
runtimeOptions.partials,
);
handlebars.registerPartial(
templateName,
fs.readFileSync(templatePath, 'utf-8'),
);
});
}

const rendered = this.precompiledTemplates[templateName](
Expand Down

0 comments on commit 7f2cbae

Please sign in to comment.