mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 21:00:01 +08:00
27 lines
516 B
TypeScript
27 lines
516 B
TypeScript
/// <reference types="node" />
|
|
/// <reference types="co-views" />
|
|
|
|
import * as views from 'co-views';
|
|
|
|
const render = views('views', {
|
|
map: {
|
|
html: 'swig',
|
|
},
|
|
default: 'jade',
|
|
});
|
|
|
|
const fileName = 'xxx'; // template file name
|
|
const locals = {}; // template locals data
|
|
|
|
async function test() {
|
|
const html = await render(fileName, locals);
|
|
console.log(html);
|
|
}
|
|
|
|
// or use generator
|
|
|
|
// function* test() {
|
|
// const html = yield render(fileName, locals);
|
|
// console.log(html);
|
|
// }
|