@acoustic-content-sdk/hbs-tooling

Utility functions to implement handlebars based tooling functionality.

Usage no npm install needed!

<script type="module">
  import acousticContentSdkHbsTooling from 'https://cdn.skypack.dev/@acoustic-content-sdk/hbs-tooling';
</script>

README

npm

Utility functions to implement handlebars based tooling functionality.

API Documentation

Home > @acoustic-content-sdk/hbs-tooling

hbs-tooling package

Utility functions to implement handlebars based tooling functionality.

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

Constructs a handlebars compiler

Signature:

export declare function createCompiler(aHandlebars?: HandlebarsType): UnaryFunction<string, TemplateType>;

Parameters

Parameter Type Description
aHandlebars HandlebarsType optionally a handlebars instance

Returns:

UnaryFunction<string, TemplateType>

the compiler

Home > @acoustic-content-sdk/hbs-tooling > rxApplyTemplates

rxApplyTemplates() function

Applies templates to a set of contexts

Signature:

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

Returns:

Observable<FileDescriptor<string>>

the final data stream

Home > @acoustic-content-sdk/hbs-tooling > rxReadTemplates

rxReadTemplates() function

Reads a list of files and interprets them as templates, both in the filename and the content.

Signature:

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

Returns:

Observable<TemplateDescriptor>

the compiled templates

Home > @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;
}

Home > @acoustic-content-sdk/hbs-tooling > HandlebarsType

HandlebarsType type

Type definition on the handlebars API

Signature:

export declare type HandlebarsType = ReturnType<typeof create>;

Home > @acoustic-content-sdk/hbs-tooling > TemplateDescriptor

TemplateDescriptor type

Representation of a file descriptor with templates for both the file name and the file content.

Signature:

export declare type TemplateDescriptor = [TemplateType, TemplateType];

Home > @acoustic-content-sdk/hbs-tooling > TemplateType

TemplateType type

Type definition on the handlebars template function that transforms a context into a markup string

Signature:

export declare type TemplateType = ReturnType<typeof compile>;