Skip to content
This repository has been archived by the owner on Apr 4, 2019. It is now read-only.

Peculiar Treatment of Comments #465

Open
jszaday opened this issue May 20, 2016 · 2 comments
Open

Peculiar Treatment of Comments #465

jszaday opened this issue May 20, 2016 · 2 comments
Labels

Comments

@jszaday
Copy link

jszaday commented May 20, 2016

I noticed something peculiar about the way htmlbars is treating comments; however, I am not sure if it is a bug or by design. I first noticed this when I commented out the link-to beginning and end tags around a line of code like so:

    <!-- {{#link-to 'group' group}} -->
    {{group.name}}
    <!-- {{/link-to}} -->

When I went to look at the live preview, I expected to see the group names; instead I didn't see them and when I inspected the page, I saw this. It seems like htmlbars is treating the two separate comments as one large comment and ignoring the content between them. This is not a big deal since it's easily fixed by moving the {{group.name}} line before the commented out link-to statement (like so) but I thought I'd post it here, just in case.

@mmun mmun added the bug label May 20, 2016
@mmun
Copy link
Collaborator

mmun commented May 20, 2016

Looks like a bug.

On the flip side, you can use Handlebars comments {{!-- foo --}} which should not have this problem. You shouldn't use unless you want to preserve the comments in the compiled template.

@jszaday
Copy link
Author

jszaday commented May 20, 2016

Alright, duly noted. I was not aware those are a thing and my editor (Atom) just auto inserts HTML-style comments when using the comment keyboard macro (Ctrl+/); perhaps I should look into updating their handlebars plugin as well, haha.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants