本文整理汇总了TypeScript中pug.compile函数的典型用法代码示例。如果您正苦于以下问题:TypeScript compile函数的具体用法?TypeScript compile怎么用?TypeScript compile使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了compile函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: pugSrcSnippetWithNodeModules
private pugSrcSnippetWithNodeModules(pugContent: string): string {
// compile
var options = {
pretty: true
}
var fn = pug.compile(pugContent, options);
var html = fn();
return html;
}
示例2: compileTemplate
}
////////////////////////////////////////////////////////////
/// Methods https://pugjs.org/api/reference.html#methods ///
////////////////////////////////////////////////////////////
namespace methods_tests {
let source = `p #{ name } 's Pug source code!`;
let path = "foo.pug";
let compileTemplate: pug.compileTemplate;
let template: string;
let clientFunctionString: pug.ClientFunctionString;
let str: string;
{
/// pug.compile(source, ?options) https://pugjs.org/api/reference.html#pugcompilesource-options
compileTemplate = pug.compile(source);
template = compileTemplate();
}
{
/// pug.compileFile(path, ?options) https://pugjs.org/api/reference.html#pugcompilefilepath-options
compileTemplate = pug.compileFile(path);
template = compileTemplate();
}
{
/// pug.compileClient(source, ?options) https://pugjs.org/api/reference.html#pugcompileclientsource-options
clientFunctionString = pug.compileClient(path);
str = pug.compileClient(path);
}