-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
perserveWhitespace: false #1020
Comments
This is an intended change. If you don't want it, you can configure it by tapping |
I have changed it. My only concern is that i personally consider false as an advanced feature you wouldn't normally want which in turn means any new developers to Vue will stumble on this. This version of the CLI is pretty awesome with the zero config but i would expect the defaults to be what a new/entry/mid-level developer would expect and then people that actually know what this setting is for can change it with a config. Just an opinion and figured i would express it. |
That's true, I guess this is a tradeoff since having Maybe we should expose this as a top level option to make it easier to tweak. |
Maybe we should provide a enum option for this:
Setting to |
This would be pending vuejs/vue#7598 |
In case of someone doesn't know how to change the option back, just put the following code in vue.config.js
|
@bruceCzK Thank you very much I have two button elements separated by a space by intention. After upgrading my project to version 3 of the CLI the space is gone. |
F.Y.I. to all: We'll have new strategy available in the upcoming v2.6. See vuejs/vue#9208 (comment). |
BREAKING CHANGE: Detailed explanation: vuejs/vue#9208 (comment) Take the following template as example: ``` <p> Welcome to <b>Vue.js</b> <i>world</i>. Have fun! </p> ``` With `preserveWhitespace: false`, it was compiled as: ``` <p> Welcome to <b>Vue.js</b><i>world</i>. Have fun! </p> ``` With `whitespace: 'condense'`, it is now compiled as: ``` <p> Welcome to <b>Vue.js</b> <i>world</i>. Have fun! </p> ``` Note the **inline whitespace between tags** is preserved. Closes #1020
Just o add to this have the latest cli and preserveWhitespace = true still does not work my index.html in public folder is well spaced and laid out but when npm run build the index.html in dist folder has whitespace removed. |
Thank u!!! You save my time!! |
For people seeing this with
|
Thanks, this is what works for vue cli 3 and 4 atm. Should put this in the official docs imo. |
This doesn't seem to work anymore with Vue 3, it throws the error: "TypeError: Cannot set property 'whitespace' of undefined". Any workaround for Vue 3? |
Version
3.0.0-beta.6
Reproduction link
1864cef
Steps to reproduce
1864cef
What is expected?
preserveWhitespace: true
What is actually happening?
preserveWhitespace: false
White space is an expected design pattern in HTML. I would expect the default to be true and the few people that want false to have to configure it. This will be a challenge for anyone new to vue/webpack in that they wont understand why their formatting doesn't look normal.
The text was updated successfully, but these errors were encountered: