-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reason for: 4.7 Always place block statements after the normal HTML attributes #25
Comments
I guess the reason for rule 4.7 was just a matter of taste, and together with rule 4.2 such a usage before declaration is unlikely but not impossible. I tend to agree that it would most probably make more sense to put the attributes Just out of curiosity: Is the "usage before declaration" pattern a real issue in any HTL compiler or does the Sling HTL implementation just work fine with it (although the HTL spec does not mandate that order)? |
Thanks for the quick reply, it sounds promising.
It works fine in Sling, I'm not sure about other compilers (I heard only of npm engine besides Sling). |
I guess the reason is that you want your file to look as "plain HTML" as possible. Therefore, it is convenient to put the data-sly-* attributes last. They are not shown in the actual HTML output, thus are less important when trying to read the HTML document. |
Well, I tend to disagree. Just think about |
I would strongly disagree. Standard attributes determine look and content, while HTL blocks determine look, content and most importantly document structure. I think people are more interested in what is eg. |
Hi guys,
I'm working on AEM IntelliJ Plugin which supports HTL and got issue report about variables resolving.
In such code:
variables are unresolved because in the plugin I assume that (according to HTL specification) identifiers scope for
data-sly-use
,data-sly-test
,data-sly-set
anddata-sly-unwrap
is specified as:For me, the "after its declaration" phrase means that usage before the declaration is disallowed. Maybe I'm wrong with interpretation.
My question is: what is the reason for adding rule 4.7 to the style guide? In my opinion, code is hard to read when declarations are specified after actual usages and I would even add rule exactly opposite to the current 4.7 - to put HTL blocks always before any other attributes. Is there any technical reason for the current state or it was introduced for better code organization and putting standard attributes before HTL blocks was a random decision or a matter of taste? Maybe it's worth to change it to make code cleaner and follow HTL spec?
The text was updated successfully, but these errors were encountered: