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

in Vue template, space and new line between element tags are not ignored #12290

Closed
jdchen2021 opened this issue Sep 20, 2021 · 3 comments
Closed

Comments

@jdchen2021
Copy link

Version

2.6.14

Reproduction link

sfc.vuejs.org/

Steps to reproduce

<template>
	<div>
		<p>
			hello world
		</p>
	</div>
</template>

Inspect "hello world".
There are spaces before and after "hello world" cause by spacing and newline in the template.

What is expected?

<p>hello world</p>

What is actually happening?

<p> hello world </p>


The space before and after "hello world" is not wanted.

@posva
Copy link
Member

posva commented Sep 20, 2021

This is expected behavior and consistent with how HTML works

It can be configured with the compiler options for whitespace and it is documented

@posva posva closed this as completed Sep 20, 2021
@sanjaybishi
Copy link

sanjaybishi commented Sep 23, 2021

This is expected behavior and consistent with how HTML works

It can be configured with the compiler options for whitespace and it is documented

Hi, I am too facing the same issue. Can you please share the way how to configure the compiler options and the document too?

Can I fix this white space issue through the lint? because if I am removing the space and run, not getting white space anymore. But lint rules again reverting to the previous format.

@hawkeye64
Copy link

Go here: https://github.com/vuejs/vue/tree/dev/packages/vue-template-compiler#api

and just a little further down, look for whitespace. Options are condense or preserve (default).

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

No branches or pull requests

4 participants