html-build
Version:
Utility script to build HTML documents - Appends scripts and styles, removes debug parts, append HTML partials, template options, etc.
88 lines (87 loc) • 2.83 kB
TypeScript
import { IOptions } from "glob";
import { Dictionary } from "./util";
export interface ParamsOptions {
beautify?: HTMLBeautifyOptions;
logOptionals?: boolean;
replace?: boolean;
relative?: boolean;
basePath?: string;
keepTags?: boolean;
scripts?: ParamsFiles;
styles?: ParamsFiles;
sections?: ParamsFiles;
data?: Object;
parseTag?: string;
processFiles?: boolean;
processPath?: ProcessPathFunction;
useFileName?: boolean;
EOL?: string;
prefix?: string;
suffix?: string | SuffixFunction;
allowUnknownTags?: boolean;
target?: string;
}
export interface Params {
beautify?: HTMLBeautifyOptions | boolean;
logOptionals: boolean;
replace?: boolean;
relative: boolean;
basePath?: string;
keepTags: boolean;
scripts: ParamsFiles;
styles: ParamsFiles;
sections: ParamsFiles;
data: Object;
parseTag: string;
processFiles: boolean;
processPath: ProcessPathFunction;
useFileName: boolean;
EOL: string;
prefix?: string;
suffix?: string | SuffixFunction;
allowUnknownTags?: boolean;
target?: string;
regexTagStart: string;
regexTagEnd: string;
filesContext: FilesContext;
}
export interface ParamsFilesOptions extends IOptions {
files?: string[];
required?: boolean;
}
export interface HTMLBeautifyOptions {
indent_inner_html?: boolean;
indent_body_inner_html?: boolean;
indent_head_inner_html?: boolean;
indent_size?: number;
indent_char?: string;
wrap_line_length?: number;
preserve_newlines?: boolean;
max_preserve_newlines?: number;
indent_handlebars?: boolean;
wrap_attributes?: "auto" | "force" | "force-expand-multiline" | "force-aligned" | "aligned-multiple";
wrap_attributes_indent_size?: number;
end_with_newline?: boolean;
extra_liners?: string[];
eol?: string;
indent_with_tabs?: boolean;
disabled?: boolean;
inline?: string[];
void_elements?: string[];
unformatted?: string[];
content_unformatted?: string[];
indent_scripts?: "keep" | "separate";
}
export interface FilesContext {
path: string;
dir: string;
file: string;
filename: string;
dirname: string;
platform: string;
}
export declare type ParamsFiles = Dictionary<ParamsFilesContent | Dictionary<ParamsFilesContent | Dictionary<ParamsFilesContent>>>;
export declare type ParamsFilesContent = string | string[] | ParamsFilesOptions;
export declare type SuffixFunction = (path: string, url: string) => string;
export declare type ProcessPathFunction = (pathes: string[], params: Params, opt: ParamsFilesOptions) => string[];
export declare function getParams(src: string, opt?: ParamsOptions): Params;