本文整理汇总了TypeScript中jade.renderFile函数的典型用法代码示例。如果您正苦于以下问题:TypeScript renderFile函数的具体用法?TypeScript renderFile怎么用?TypeScript renderFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了renderFile函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: generateDefinitionFile
public generateDefinitionFile(changelog: Changelog, version: string): GeneratedFile {
return new GeneratedFile(`/${version}/index.html`,
html.prettyPrint(jade.renderFile(__dirname + "/../../resources/view/index.jade", {
version: version,
changelog: changelog,
api: this
})));
}
示例2: generateRootFile
public generateRootFile(changelog: Changelog): GeneratedFile {
return new GeneratedFile("/index.html",
html.prettyPrint(jade.renderFile(__dirname + "/../../resources/view/root.jade", {
name: this.name,
description: this.description,
versions: changelog.changes
})));
}
示例3: sendMail
private static sendMail(letter: Letter, billPath: string, callback: (error: Error) => void) {
var nodemailer = require("nodemailer");
var jade = require('jade');
var dateFormat = require('dateformat');
var prettyPassedToPrintingProviderAt = dateFormat(letter.printInformation.passedToPrintingProviderAt, "shortDate");
var prettyDispatchedByPrintingProviderAt = dateFormat(letter.printInformation.passedToPrintingProviderAt, "shortDate");
var options = { pretty: true,
invoiceNumber: letter.invoiceNumber,
serverPath: Config.getBaseUri()
};
jade.renderFile(Config.getBasePath() + '/views/email.jade', options, function (err, html) {
if (err) {
callback(err);
return;
}
// create reusable transport method (opens pool of SMTP connections)
var smtpTransport = Config.getNodemailerTransport();
var message = "Please see the HTML Version of this email for more information.";
// setup e-mail data with unicode symbols
var mailOptions = {
from: "hello@milsapp.com", // sender address
to: letter.issuer.email, // list of receivers
subject: "Mils Billing", // Subject line
text: message, // plaintext body
html: html, // html body,
attachments : [{fileName: 'Invoice.pdf', filePath: billPath}] // TODO: Check whether this is correct
};
// send mail with defined transport object
smtpTransport.sendMail(mailOptions, function(error, response){
// if you don't want to use this transport object anymore, uncomment following line
smtpTransport.close(); // shut down the connection pool, no more messages
callback(error);
});
});
}
示例4: notifyCustomerViaEmail
public static notifyCustomerViaEmail(letter: Letter, callback: (error: Error) => void) {
var nodemailer = require("nodemailer");
var jade = require('jade');
var dateFormat = require('dateformat');
var prettyPassedToPrintingProviderAt = dateFormat(letter.printInformation.passedToPrintingProviderAt, "shortDate");
var prettyDispatchedByPrintingProviderAt = dateFormat(letter.printInformation.passedToPrintingProviderAt, "shortDate");
var options = { pretty: true,
destination: letter.recipient.countryIso,
passedToPrintingProviderAt: prettyPassedToPrintingProviderAt,
dispatchedByPrintingProviderAt: prettyDispatchedByPrintingProviderAt,
serverPath: Config.getBaseUri()
};
jade.renderFile(Config.getBasePath() + '/views/dispatched_email.jade', options, function (err, html) {
if (err) throw err;
// create reusable transport method (opens pool of SMTP connections)
var smtpTransport = Config.getNodemailerTransport();
var message = "Your letter to " + letter.recipient.countryIso + " from " + prettyPassedToPrintingProviderAt + " was dispatched at " + prettyDispatchedByPrintingProviderAt;
// setup e-mail data with unicode symbols
var mailOptions = {
from: "hello@milsapp.com", // sender address
to: letter.issuer.email, // list of receivers
subject: "Your Letter was Dispatched", // Subject line
text: message, // plaintext body
html: html // html body
};
// send mail with defined transport object
smtpTransport.sendMail(mailOptions, function(error, response){
// if you don't want to use this transport object anymore, uncomment following line
smtpTransport.close(); // shut down the connection pool, no more messages
callback(error);
});
});
}
示例5: render
export function render(req, res, next) {
if (res.form) {
res.html = {content : jade.renderFile(path.join(__dirname, './form.jade'), { form: res.form })};
}
next();
}
示例6: sendResetPassword
sendResetPassword(data, callback){
data.logo_url = config.dns + '/public/images/logo.png';
let html = jade.renderFile('./lib/email-templates/reset-password.jade', data);
this.send('Reset your account password for yummlet.com', html, From.ADMIN_YUMMLET, data.email, callback);
}
示例7: sendActivation
sendActivation(data, callback) {
data.logo_url = config.dns + '/public/images/logo.png';
let html = jade.renderFile('./lib/email-templates/activation.jade', data);
this.send('Activate your account at yummlet.com', html, From.ADMIN_YUMMLET, data.email, callback);
}
示例8: render
export function render(req : Request, res : Response, next) {
if(res.grid) {
res.html = Object.assign({content : jade.renderFile(join(__dirname,'grid.jade'), {grid: res.grid})}, res.html);
}
return next();
}
示例9:
import * as jade from 'jade';
jade.compile("b")();
jade.compileFile("foo.jade", {})();
jade.compileClient("a")({ a: 1 });
jade.compileClientWithDependenciesTracked("test").body();
jade.render("h1", {});
jade.renderFile("foo.jade");