Skip to content

Commit

Permalink
feat: add support for Eta template engine
Browse files Browse the repository at this point in the history
  • Loading branch information
exoup committed Sep 30, 2023
1 parent 424a693 commit 3a6d304
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions lib/consolidate.js
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,44 @@ exports.ejs.render = function (str, options, cb) {
});
};

/**
* Eta support.
*/

exports.eta = function (path, options, cb) {
return promisify(cb, function (cb) {
try {
const engine =
requires.eta ||
(requires.eta = new (require('eta').Eta)({
views: '.'
}));
cb(null, engine.render(path, options));
} catch (err) {
cb(err);
}
});
};

/**
* Eta string support.
*/

exports.eta.render = function (str, options, cb) {
return promisify(cb, function (cb) {
try {
const engine =
requires.eta ||
(requires.eta = new (require('eta').Eta)({
views: '.'
}));
cb(null, engine.renderString(str, options));
} catch (err) {
cb(err);
}
});
};

/**
* Eco support.
*/
Expand Down

0 comments on commit 3a6d304

Please sign in to comment.