本文整理匯總了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");