squirrelly
Version:
Lightweight, fast, and powerful JS template engine. Supports helpers, filters, template inheritance
49 lines (48 loc) • 1.51 kB
TypeScript
export declare type FetcherFunction = (container: 'H' | 'F', name: string) => Function | undefined;
import { HelperFunction, FilterFunction } from './containers';
import { TemplateFunction } from './compile';
import { Cacher } from './storage';
declare type trimConfig = 'nl' | 'slurp' | false;
export interface SqrlConfig {
varName: string;
autoTrim: trimConfig | [trimConfig, trimConfig];
rmWhitespace?: boolean;
autoEscape: boolean;
defaultFilter: false | string;
tags: [string, string];
l: FetcherFunction;
plugins: Array<{
processFnString?: Function;
processAST?: Function;
}>;
async: boolean;
storage: {
helpers: Cacher<HelperFunction>;
nativeHelpers: Cacher<Function>;
filters: Cacher<FilterFunction>;
templates: Cacher<TemplateFunction>;
};
prefixes: {
h: string;
b: string;
i: string;
r: string;
c: string;
e: string;
[index: string]: string;
};
cache: boolean;
views?: string | Array<string>;
root?: string;
filename?: string;
name?: string;
'view cache'?: boolean;
useWith?: boolean;
[index: string]: any;
}
export declare type PartialConfig = {
[P in keyof SqrlConfig]?: SqrlConfig[P];
};
declare var defaultConfig: SqrlConfig;
declare function getConfig(override: PartialConfig, baseConfig?: SqrlConfig): SqrlConfig;
export { defaultConfig, getConfig };