Starting with 22.1, the Handlebars library used for templates in Smart UI will be upgraded from 3.0.8 to 4.7.7. Existing precompiled templates produced by Handlebars 3 will continue to be supported. This means that precompiled templates from previously released versions of CS modules will continue to work in Content Server 22.1 without modification.
Moving forward, builds produced using Smart UI SDK 22.1 will be using Handlebars 4 to precompile templates. This means that CS modules built using Smart UI SDK 22.1 will only be compatible with Content Server 22.1 or later. There are also two potential breaking changes that may require changes to existing templates when building with Handlebars 4.
First, the “=” character is now HTML escaped in templates. This mainly affects the use case where multiple attributes are added to a template through a single property:
template: <a {{attrs}}>
data: { attrs = “href=http://test title=test” }
In this case, the template should be modified so that each attribute is added through a separate property:
template: <a href=”{{attrHref}}” title=”attrTitle”>
data: { attrHref = "http://test”, attrTitle=”test" }
Second, relative paths have been simplified to remove unnecessary levels of context:
{{#each fields}}
{{#if this.isSetType}}
<div id="{{../../modelId}}{{@index}}">
</div>
{{/if}}
{{/each}}
If you have properties in your templates that navigate backwards through context, e.g. “../”, you will need to test after building with CSUI 22.1 to see if the templates still work. If the templates are not rendering correctly, you may need to remove a level of context:
{{#each fields}}
{{#if this.isSetType}}
<div id=”{{../modelId}}{{@index}}”>
</div>
{{/if}}
{{/each}}
Regards,
Leonhard.