Answer the question
In order to leave comments, you need to log in
How to include mixins in a template?
Hello, there is a function that connects pug templates:
let yua_func = function(path, params) {
return pug.renderFile(path, params);
};
Answer the question
In order to leave comments, you need to log in
There is none out of the box. You can try to work around it like this:
const includeMixins = 'include path/to/mixins.pug\n'; // тут можно написать много инклюдов
function yua_func(path, params, cb) {
fs.readFile(path, (err, file) => {
const template = includeMixins + file.toString();
cb(pug.compile(template, params));
});
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question