UNPKG

1.61 kBTypeScriptView Raw
1// Type definitions for jade
2// Project: https://github.com/jadejs/jade
3// Definitions by: Panu Horsmalahti <https://github.com/panuhorsmalahti>
4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
6export type JadeCustomFilterFunction = (text: string, options: {
7 [key: string]: boolean;
8}) => string;
9
10export interface JadeOptions {
11 filename?: string | undefined;
12 basedir?: string | undefined;
13 doctype?: string | undefined;
14 pretty?: boolean | string | undefined;
15 filters?: {
16 [key: string]: JadeCustomFilterFunction
17 } | undefined;
18 self?: boolean | undefined;
19 debug?: boolean | undefined;
20 compileDebug?: boolean | undefined;
21 globals?: string[] | undefined;
22 cache?: boolean | undefined;
23 inlineRuntimeFunctions?: boolean | undefined;
24 name?: string | undefined;
25}
26
27export interface TemplateLocals {
28 [key: string]: any;
29}
30
31export type JadeGenerationFunction = (locals?: TemplateLocals) => string;
32
33export declare function compile(template: string, options?: JadeOptions): JadeGenerationFunction;
34export declare function compileFile(path: string, options?: JadeOptions): JadeGenerationFunction;
35export declare function compileClient(template: string, options?: JadeOptions): JadeGenerationFunction;
36export declare function compileClientWithDependenciesTracked(template: string, options?: JadeOptions): {
37 body: JadeGenerationFunction;
38 dependencies: string[];
39};
40export declare function render(template: string, options?: JadeOptions): string;
41export declare function renderFile(path: string, options?: JadeOptions): string;