Is this v-for whitespace stripping expected with whitespace: 'preserve'
compiler option?
#12842
Unanswered
alexchexes
asked this question in
Help/Questions
Replies: 2 comments 5 replies
-
Interestingly, if I do it manually like this: <template>
<div>
Words:
<span> word1 </span><span> word2 </span><span> word3 </span>
</div>
</template> I get the output I expect: However, if I do this: <template>
<div>
Words:
<span> {{ words[0] }} </span><span> {{ words[1] }} </span><span> {{ words[2] }} </span>
</div>
</template> I end up with the same whitespace-stripped result as with |
Beta Was this translation helpful? Give feedback.
0 replies
-
See: core/packages/compiler-core/src/parser.ts Lines 848 to 852 in 263f63f |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I am using Vue 3.5.13 / Vite 6.1.0.
I configured Vite to preserve whitespaces as follows:
However, the following code produces results like the screenshots below—there are no spaces between the
<span>
elements.I searched for similar questions about preserving whitespaces in Vue templates. While I found a few, most seem outdated, as there were earlier bugs that appear to have been fixed.
So my question is:
Is the current behavior, where the
whitespace: 'preserve'
compiler option still strips whitespaces betweenv-for
elements, expected?Beta Was this translation helpful? Give feedback.
All reactions