Merge pull request #5362 from MrHen/feature/swig-email-templates

Typings for swig-email-templates
This commit is contained in:
Masahiro Wakame
2015-08-17 22:32:40 +09:00
2 changed files with 37 additions and 0 deletions

View File

@@ -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
});
});

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
}