Remove all white spaces between any tags
See original GitHub issueI have complete control over my HTML code and I really need to remove all spaces between all type of elements: block level and inline level — now white spaces collapses only between block level elements.
Is there a way to remove all spaces between all tags completely?
(I’m using grunt-contrib-htmlmin v0.3.0 Grunt plugin which is a wrapper of HTML minifier)
I’ve found similar issues like #273, but I still got spaces between <button>
or <span>
tags.
Issue Analytics
- State:
- Created 9 years ago
- Reactions:1
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Remove white spaces between tags in HTML - php
You need use a regular expresion. Maybe you can use this: $html = preg_replace('/\>\s+\</m', '><', $html);. Test here https://repl.it/.
Read more >Remove Whitespace in Html with Javascript - Jake Trent
Here's some javascript to strip out the whitespace between xml/html tags. I'm no regex guru, so I split this into 4 separate pieces:...
Read more >How to remove the white space between elements - YouTube
4 elements with a width of 25% and a display of inline-block, should all appear on the same line. However, that's not always...
Read more >Remove All White Space Between Tags - TeX
Ideally it would be across many lines as shown in the first example, because this will eventually be a long string generated by...
Read more >How to remove the space between inline-block elements?
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, ...
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 Free
Top 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
Btw, here is a quick fix, using
gulp-replace
(just add this after.pipe(htmlmin(...))
):Following, white-spaces around inline tag might remove, isn’t it? (need to add new options like
removeInlineTagWhitespace
)