alapa
Version:
A cutting-edge web development framework designed to revolutionize the way developers build modern web applications.
28 lines (27 loc) • 1.01 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.nunjucksRender = void 0;
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/no-explicit-any */
class RemoveIfExtension {
tags = ["macro"];
parse(parser, nodes, lexer) {
// Ignore the 'if' tag, effectively removing it
return new nodes.CallExtension(this, "render", [], []);
}
}
const nunjucks_1 = require("../loaders/nunjucks");
const nunjucks_2 = __importDefault(require("nunjucks"));
const nunjucksRender = (filePath, context) => {
const env = new nunjucks_2.default.Environment([new nunjucks_1.NunJunksLoader()], {
autoescape: true,
throwOnUndefined: true,
watch: true,
});
const data = env.render(filePath, context);
return data;
};
exports.nunjucksRender = nunjucksRender;