Closed paulochang closed 4 months ago
This potentially means we should now recommend the usage of data-sly-set when possible.
I would rather say: only when absolutely needed.
An example of data-sly-test
abusing can be found here:
https://github.com/adobe/aem-core-wcm-components/issues/878
@paulochang I agree, can you come up with a PR? I guess we should clarify https://github.com/Netcentric/aem-htl-style-guide#4.5
Yes, I will try to come up with either a rewording or clarification of the rule.
@karollewandowski could you clarify what you think should be avoided so I can incorporate your comment?
I meant overusing it for defining variables for very simple cases like:
<sly data-sly-set.details="${product.details}"></sly>
${details.name}
${details.price}
<!-- product is not used anymore after those 2 usages above -->
I think that such code should be preferred:
${product.details.name}
${product.details.price}
So in cases when set
result is used for defining variables for expressions that are very cheap and used very few times. Maybe it is too obvious to mention it in the rules. I just wouldn't use words "when possible" to avoid spreading such overusing.
It just took me a few years! Please check my pr @kwin @karollewandowski
HTL Spec was updated in June 2018 to support variable setting via data-sly-set (https://github.com/adobe/htl-spec/blob/1.4/SPECIFICATION.md#2212-set) and available in AEM 6.5 (https://docs.adobe.com/content/help/en/experience-manager-65/release-notes/sites.html), AEM 6.3 SP3 and AEM 6.4 SP1 (https://github.com/adobe/htl-spec).
This potentially means we should now recommend the usage of
data-sly-set
when possible.We should probably also mention that setting up variables by abusing the
data-sly-test.identifier
pattern for cases other than test blocks is to be avoided when possible.(https://github.com/Netcentric/aem-htl-style-guide#4.5).