當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript jade.renderFile函數代碼示例

本文整理匯總了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
      })));
  }
開發者ID:guedjm,項目名稱:api-doc-generator,代碼行數:9,代碼來源:apiDefinition.ts

示例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
      })));
  }
開發者ID:guedjm,項目名稱:api-doc-generator,代碼行數:9,代碼來源:apiDefinition.ts

示例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);
            });
        });
    }
開發者ID:arein,項目名稱:Mils-Server,代碼行數:40,代碼來源:BillHelper.ts

示例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);
            });
        });
    }
開發者ID:arein,項目名稱:Mils-Server,代碼行數:38,代碼來源:NotificationManager.ts

示例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();
}
開發者ID:srikanthdarmapuri,項目名稱:cms-forms,代碼行數:6,代碼來源:index.ts

示例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);
 }
開發者ID:zaksie,項目名稱:gotouch,代碼行數:5,代碼來源:mailer.ts

示例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);
 }
開發者ID:zaksie,項目名稱:gotouch,代碼行數:5,代碼來源:mailer.ts

示例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();
}
開發者ID:rajivnarayana,項目名稱:cms-grids,代碼行數:6,代碼來源:index.ts

示例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");
開發者ID:AbraaoAlves,項目名稱:DefinitelyTyped,代碼行數:8,代碼來源:jade-tests.ts


注:本文中的jade.renderFile函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。