haraka-plugin-webmailer/templates/index.js

11 lines
376 B
JavaScript

let fs = require('fs');
let templateFiles = fs.readdirSync(__dirname, "utf8").filter(
x => x[0] !== "." && x !== "index.js"
);
let templates = templateFiles.reduce((obj, file) => { obj[file.split(".")[0]] = require(`./${file}`); return obj;}, {});
module.exports = function() {
//I might want to make this asynchronous very soon
return Promise.resolve(templates);
};