Skip to content
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

Make it possible to retain html comments #2602

Closed
ferencbeutel4711 opened this issue Nov 13, 2020 · 7 comments
Closed

Make it possible to retain html comments #2602

ferencbeutel4711 opened this issue Nov 13, 2020 · 7 comments

Comments

@ferencbeutel4711
Copy link

ferencbeutel4711 commented Nov 13, 2020

Please note, that this request is concerning vue sfc files. (.vue-files)

What problem does this feature solve?

For technologies like server-side-includes it is really important to retain html comments in certain scenarios. There was an option to retain them for vue-2 (https://vuejs.org/v2/api/#comments), however, that seems to be removed from vue-3 :(
I could not find anything concerning this feature in the vue-3 docs.

What does the proposed API look like?

an option would be to keep the v-2 api

@posva
Copy link
Member

posva commented Nov 13, 2020

This was added at #1858

@posva posva closed this as completed Nov 13, 2020
@ferencbeutel4711
Copy link
Author

ferencbeutel4711 commented Nov 13, 2020

Hi, thanks for your swift response. I am not sure if I understand the context of your linked PR & issue, but to me it sounds like only useful in a situation where I am using the parse() function of vue/compiler-core. In my scenario, I am creating a new instance of a vue component inside of a sfc file. In vue2, the comments: <boolean> option was exposed directly in the options of a component, however that api has now changed (because if configured there, the comments are still lost), and I do not understand where I would specify that option now.

@vhoyer
Copy link

vhoyer commented Nov 13, 2020

try <template comments>, this is the syntax for vue 2, haven't really tried this with vue 3

@ferencbeutel4711
Copy link
Author

hi vhoyer, I have just tried that and sadly, it did not preserve my comments. ty for the input though

@JasperTey
Copy link

From what I gather, the <template comments> capability is not supported in Vue 3 SFCs? Is there any workaround available? In my case, the HTML comments are being stripped out only in production mode, and I'm confused where the root cause of the behaviour lies; my webpack config, the internal behaviour of @vue/compiler-sfc, or just Vue 3 in general?

@rafaelsouzaf
Copy link

@ferencbeutel4711 Could you find a solution?

@kospl
Copy link

kospl commented Mar 27, 2021

@JasperTey your case looks behaving this way because of this internal compiler bug: #3392

@github-actions github-actions bot locked and limited conversation to collaborators Oct 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants