7

I'm in a situation where I legally have to add a copyright notice to the top of my files and while I know how I can comment inside either template, script or style, I couldn't find documentation regarding how to do it outside these.

Based on the structure of the file, I assume the standard HTML comment (<!-- Hi there! -->) should work, and it both: a.) seems to work and b.) my syntax highlighter accepts it.

However, I'd like to be sure about it and understand how and why it works this way, I was surprised it is seemingly not covered in the Vue docs.

1
  • 1
    The syntax highlighting is a function of the Vetur VS Code extension, which parses .vue files as HTML, so you should use HTML comments outside the standard SFC blocks. Commented Feb 26, 2021 at 21:24

1 Answer 1

4

Yep, you are right. There is a confirmation here: https://vue-loader.vuejs.org/spec.html#src-imports

Sign up to request clarification or add additional context in comments.

1 Comment

That was my thinking exactly, I became confused when I saw that VS Code highlights a <!-- --> comment, but doesn't recognise a // or /* */ I know it functions as a JS file, but by the looks of it it kind of has three HTML root elements.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.