diff2html/website/templates/helpers/block.js
biodiscus 818f752714 optimize webpack config for faster build website
- switch to modern html-bundler-webpack-plugin
- replace deprecated `file-loader` and `url-loader` with Webpack 5 assets module
- create single webpack config instead of two configs
2023-09-03 12:00:59 +02:00

24 lines
588 B
JavaScript

'use strict';
/* eslint-disable @typescript-eslint/no-var-requires */
const Handlebars = require('handlebars');
/** @typedef {import('handlebars').HelperOptions} HelperOptions */
/**
* @param {string} name
* @param {HelperOptions}
* @return {string}
*/
module.exports = function (name, options) {
// eslint-disable-next-line
const context = this;
let partial = context._blocks[name] || options.fn;
if (typeof partial === 'string') {
partial = Handlebars.compile(partial);
context._blocks[name] = partial;
}
return partial(context, { data: options.hash });
};