Typings for swig-email-templates

This commit is contained in:
Adam Babcock
2015-08-13 22:58:07 -05:00
parent e95958ac84
commit 374918ca1e
2 changed files with 37 additions and 0 deletions
@@ -0,0 +1,16 @@
/// <reference path="swig-email-templates.d.ts" />
import emailTemplates = require('swig-email-templates');
var options = {
root: "root"
};
emailTemplates(options, function(err, render) {
var context = {
meatballCount: 9001,
};
render('meatball-sandwich.html', context, function(err, html, text) {
// send html/text email
});
});
+21
View File
@@ -0,0 +1,21 @@
// Type definitions for swig-email-templates
// Project: https://github.com/andrewrk/swig-email-templates
// Definitions by: Adam Babcock <https://github.com/mrhen>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../swig/swig.d.ts" />
declare module "swig-email-templates" {
import swig = require('swig');
interface SwigRender<T> {
(file:string, context:T, callback:(err:any, html:string, text:string)=>any):any;
}
interface SwigEmailTemplatesOptions extends swig.SwigOptions {
root?: string;
}
function init<T>(options:SwigEmailTemplatesOptions, cb:(err:any, render:SwigRender<T>)=>any):any;
export = init
}