0

The lightning aura component comment syntax common to HTML <!-- comment --> generates a comment also in the generated HTML.

There is a way to insert comments in the source code of the .cmp file of the lightning aura component that does not generate a corresponding comment in the generated HTML?

2 Answers 2

1

I am not aware of an "official" way to do this but one quick way to accomplish this would be to wrap your comment in an aura:if tag:

<aura:if isTrue="false">Insert comment here</aura:if>

This is pretty hacky but you could easily create a component called "comment" that accomplishes the same thing and would look better like this:

<c:comment>Insert comment here</c:comment>

1
  • 1
    +1 just because it works... in theory. Practically, there is no way that it is advisable to insert nop code just to insert comments. :(
    – gvgramazio
    Feb 9, 2020 at 19:22
-1

Insert comments using

<!-- This is your comment -->

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_markup.htm

1
  • I think that you didn’t bother reading the question.
    – gvgramazio
    Nov 22, 2020 at 19:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .