Feature request: provide option for removing all spaces arround tag
See original GitHub issueWhat 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'
}
Issue Analytics
- State:
- Created 4 years ago
- Reactions:14
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Option to trim whitespace between tags · Issue #3080 ...
I'm used to JSX, where whitespace is automatically trimmed, and you have to insert it manually with {" "} when you want it....
Read more >Feature Requests
I would like to have a native integration with WPAdverts that allows Spaces to publish classifieds via their Spaces profile. The classifieds should...
Read more >How to auto-remove trailing whitespace in Eclipse?
In order to do that right-click on your project and go to Properties -> Java Editor -> Save Actions. From there you can...
Read more >About Twitter Spaces
Listeners can request permission to speak from the host by selecting the Request icon below the microphone. Step 6. When creating a Space,...
Read more >Working with ticket tags
Deleting a tag from a ticket only removes the tag from that ticket; the tag will still appear on other tickets and in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can list more example, but it is not what I’m requesting. JSX has this feature, And I think there should be an ability for developer to choose which code style they prefer, rather than no choice.
eg1: Which one do you think is the best? We choose 3.
eg2: Which one do you think is better? We choose 1.
As I understand the feature you are asking for is exactly the same with the original proposal here in #9208. Maybe we can add a new value for the
whitespace
option value like'jsx'
? @yyx990803