The wait is over. A new release of NitroNet & NitroNet for Sitecore is here!
With extensive updates to the documentation, some small code fixes and improvements, the 2.0.0 version of NitroNet introduces also a brand-new feature called Additional Arguments which allows to be more flexible and more compatible with the handlebars templates created with Nitro by the friendly frontend engineer of your choice. Get your hands on it in the official GitHub repositories of NitroNet and NitroNet.Sitecore.
Introducing: Additional Arguments!
Additional Arguments is based on Handlebar.js's concept of Literals. The feature allows you to pass literal values to a helper. For NitroNet it has been extended to not only handle static values, but also support dynamic properties resolved from the current context.
Let's have a look at an example setup for Additional Arguments
To manage the behaviour more granularly, a new setting has been added to nitro-config.json.
The AdditionalArgumentsParsingMode-Setting has 3 modes. For this introduction we look at the result of the given setup under the different modes.
If the setting isn't present or set to "none", the behaviour is exactly as you know it. "modifier" and "decorator" are ignored and the subcomponent model gets passed as it is. This mode exists to ensure backward compatibility. If you don't want your HTML to be affected by the Additional Arguments feature, this is the mode to go.
In this mode only static values, i.e. strings, numbers, true, false, null and undefined are parsed and passed to the subcomponent together with the model. Additional Arguments always overwrite values set on the subcomponent model. As you can see the additional argument "modifier" is ignored.
All additional arguments are resolved. The modifier is resolved from the ParentComponentModel, meaning it results in a value "parent-default" which is then passed to the subcomponent.
More information on this new feature
The complete documentation of this feature is on the official GitHub repositories
Thanks to the following persons which helped to make this release possible!