mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-19 05:03:32 +08:00
Merge pull request #5362 from MrHen/feature/swig-email-templates
Typings for swig-email-templates
This commit is contained in:
16
swig-email-templates/swig-email-templates-tests.ts
Normal file
16
swig-email-templates/swig-email-templates-tests.ts
Normal 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
|
||||
});
|
||||
});
|
||||
21
swig-email-templates/swig-email-templates.d.ts
vendored
Normal file
21
swig-email-templates/swig-email-templates.d.ts
vendored
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user