.getTemplateLib - PeterNaydenov/code-assembly-line GitHub Wiki
Method will return all templates under specific library namespace. Exported object will exclude the namespace. Merge two or more libraries by exporting them together.
Export with no arguments will return all templates without namespace changes. Use it to transfer templates set from one engine to the other.
tplEngine.getTemplateLib ( libraryName )
- libraryName?: string | string[]. Count template libraries for export;
- Method return options:
- template: externalTemplate;
- Method is not chainable;
Example:
const templates = {
'hello' : 'Hello {{user}}' // template 'hello'
, 'sp/bye' : 'Good bye {{user}}' // template 'bye' with namespace 'sp'
, 'sp/tnx' : 'Special thanks to {{user}}' // template 'tnx' with namespace 'sp'
}
tplEngine.insertTemplate ( templates )
// Now templates are available in template engine
tplEngine.getTemplateLib ( 'sp' )
/*
-> {
'bye' : 'Good bye {{user}}' // namespace was removed from template name
, 'tnx' : 'Special thanks to {{user}}'
}
*/
tplEngine.getTemplateLib ()
/*
-> {
'hello' : 'Hello {{user}}'
, 'sp/bye' : 'Good bye {{user}}'
, 'sp/tnx' : 'Special thanks to {{user}}'
}
Returns everything as it is. No changes. Transfer templates.
*/