@acoustic-content-sdk/hbs-tooling 中文文档教程
用于实现基于把手的工具功能的实用函数。
Home > @acoustic-content-sdk/hbs-tooling
hbs-tooling package
实用函数来实现基于把手的工具功能。
Functions
Function | Description |
---|---|
createCompiler(aHandlebars) | Constructs a handlebars compiler |
rxApplyTemplates(aCtx$, aTemp$) | Applies templates to a set of contexts |
rxReadTemplates(aDir, aHandlebars) | Reads a list of files and interprets them as templates, both in the filename and the content. |
Variables
Variable | Description |
---|---|
VERSION | Version and build number of the package |
Type Aliases
Type Alias | Description |
---|---|
HandlebarsType | Type definition on the handlebars API |
TemplateDescriptor | Representation of a file descriptor with templates for both the file name and the file content. |
TemplateType | Type definition on the handlebars template function that transforms a context into a markup string |
Home > @acoustic-content-sdk/hbs-tooling > createCompiler
createCompiler() function
构建车把编译器
签名:
export declare function createCompiler(aHandlebars?: HandlebarsType): UnaryFunction<string, TemplateType>;
Parameters
Parameter | Type | Description |
---|---|---|
aHandlebars | HandlebarsType |
optionally a handlebars instance |
返回:
UnaryFunction
>编译器
@acoustic-content-sdk/hbs-tooling > rxApplyTemplates
rxApplyTemplates() function
将模板应用于一组上下文
签名:
export declare function rxApplyTemplates(aCtx$: Observable<any>, aTemp$: Observable<TemplateDescriptor>): Observable<FileDescriptor<string>>;
Parameters
Parameter | Type | Description |
---|---|---|
aCtx$ | Observable<any> |
the set of contexts |
aTemp$ | Observable<TemplateDescriptor> |
the set of templates |
返回:
Observable
the final data stream
Home > @acoustic-content-sdk/hbs-tooling > rxReadTemplates
rxReadTemplates() function
读取文件列表并将它们解释为模板,包括文件名和内容。
签名:
export declare function rxReadTemplates(aDir: string, aHandlebars?: HandlebarsType): Observable<TemplateDescriptor>;
Parameters
Parameter | Type | Description |
---|---|---|
aDir | string |
directory to start in |
aHandlebars | HandlebarsType |
optionally the handlebars instance |
返回:
Observable
编译后的模板
主页 > @acoustic-content-sdk/hbs-tooling > VERSION
VERSION variable
Version and build number of the package
Signature:
VERSION: {
version: {
major: string;
minor: string;
patch: string;
branch: string;
};
build: Date;
}
首页 > @acoustic-content-sdk/hbs-tooling > HandlebarsType
HandlebarsType type
Type definition on the handlebars API
Signature:
export declare type HandlebarsType = ReturnType<typeof create>;
首页 > @acoustic-content-sdk/hbs-tooling > TemplateDescriptor
TemplateDescriptor type
文件描述符的表示,带有文件名和文件内容的模板。
Signature:
export declare type TemplateDescriptor = [TemplateType, TemplateType];
Home > @acoustic-content-sdk/hbs-tooling > TemplateType
TemplateType type
将上下文转换为标记字符串的车把模板函数的类型定义
签名:
export declare type TemplateType = ReturnType<typeof compile>;