-
Currently, I'm using the following rule: {
test: /\.hbs$/,
use: [
{
loader: "handlebars-loader",
options: {
runtime: "handlebars/runtime",
inlineRequires: /(\/img\/|\/_svg\/)/,
},
},
{
loader: "extract-loader",
},
{
loader: "html-loader",
options: {
esModule: false,
minimize: false,
preprocessor: (content, loaderContext) => {
var replaceWithSvg = function (arg1, arg2) {
return fs.readFileSync("./src/_svg/" + arg2, "utf8", function (err, data) {
if (err) {
return "";
}
return data.fulltrim();
});
};
content = content.replace(/<!-- @insertSvg (.*) -->/g, replaceWithSvg);
return content;
},
sources: false,
},
},
],
}, I'm trying to move to I've also issues with my helpers: Currently, all of my helpers are in one file |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
Hallo @chkpnt, Thanks for the question. |
Beta Was this translation helpful? Give feedback.
@chkpnt
to use your own preprocessor you can use the beforePreprocessor callback option or beforePreprocessor hook.
In the
beforePreprocessor
you can modify the source template content.See the test case hook-beforePreprocessor.