ejs
ejs copied to clipboard
Export the Template class
Issue:
Right now trying to access the Template
class is not possible. I think that exposing the Template class would be useful since it would enable us to add new methods or override and expend existing ones without the need of having a local version of ejs and losing it as a npm dependency.
For instance if I would be trying to modify the parseTemplateText
method right now I would have to store ejs as a (modified) local copy and not as a npm module.
const ejs = require('ejs'))
ejs.Template.prototype.parseTemplateText = function() { // Throws an error :/
// ...
};
Fix:
Simply exporting the function should do the trick.
inside lib/ejs.js
module.exports.Template = Template;
function Template(text, opts) {
This sounds reasonable. How about a PR that does this?