Open
Description
What problem does this feature solve?
For now, spaces around text tag will be kept at least one space:
https://github.com/vuejs/vue/tree/dev/packages/vue-template-compiler#options
<!-- source -->
<div>
<span>
foo
</span> <span>bar</span>
</div>
<!-- whitespace: 'preserve' -->
<div> <span>
foo
</span> <span>bar</span> </div>
<!-- whitespace: 'condense' -->
<div><span> foo </span> <span>bar</span></div>
Sometimes, it will keep some space we don't want:
<!-- source -->
<span>
一段很长的文字………………,
<span>
<!-- become -->
<span> xx </span>
<!-- if we write source like this -->
<span>a_long_long_chinese_characters…<span>
<!-- it will be formatted by prettier or etc like this, very bad -->
<span
>a_long_long_chinese_characters…</span
>
Our code standard always: build tool (webpack) will kill all spaces around tag. If we need a real space, use
like this:
<!-- source if no need for spaces -->
<span>
<i class="icon"></i>
文本
</span>
<!-- result -->
<span><i class="icon"></i>文本</span>
<!-- source if need for spaces -->
<span>
<i class="icon"></i>
文本
</span>
<!-- result -->
<span> <i class="icon"></i> 文本 </span>
In this way, we get a great experience with react and vue@1.x (compress html myself).
now we are using SFC, vue-loader haven't provide this option. Spaces around tag will be kept at least one space.
So we hope vue-loader can provide an option to remove these spaces.
What does the proposed API look like?
compilerOptions: {
whitespace: 'collapse'
}
Metadata
Metadata
Assignees
Labels
No labels