Netcentric / aem-htl-style-guide

A style guide for the HTML Template Language (HTL), the templating language use by the Adobe Experience Manager (AEM).
MIT License
138 stars 50 forks source link

Added details and changed example for 3.2 #11

Closed gabrielwalt closed 9 years ago

gabrielwalt commented 9 years ago

Added guidance to choosing the proper context for expressions.

Not sure if the example isn't too complex, but it illustrates several different cases. Some of wich, like the onclick and the style attributes are a little bit borderline with 1.2 (Avoid inline JavaScript or CSS), but I guess that if someone really wants to do that, then it's better to still tell how to do it properly.

ErikGrijzen commented 9 years ago

Thank you for the enhancement.

I also think there's still a use case for using inline CSS in some cases. For example for setting a dynamic background-image it could be useful. This is something you can't do with just a class name. For inline JS I would think it's not necessary, but It wouldn't hurt to show how it should be done.

I commented on the changes you did, please let me know what you think.

gabrielwalt commented 9 years ago

Yes, which is why 1.2 doesn't say "Never inline JavaScript or CSS", but "Avoid inline JavaScript or CSS". From my experience, the problem is mostly for scripts, which are inlined way too often, for styles there's less of an issue.

ErikGrijzen commented 9 years ago

Exactly! PR is merged, thank you!