Crushing html produces unwanted "empty lines filled with whitespaces"
See original GitHub issuePackage’s name html-crush (4.1.4)
Describe the situation Here is a Simple example to reproduce my problem. It should be self explanetory 😃
const { crush } = require("html-crush")
const input = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div>Hello</div>
</body>
</html>
`
const output = crush(input, {
removeLineBreaks: true,
removeIndentations: true,
removeHTMLComments: true,
removeCSSComments: true,
})
output.result === `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body><div>Hello</div>
</body>
</html>
`
Is there something I’m doing wrong?
I would like the result to be compacted with no extra newlines/whitespaces, until the line length is reached…
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
How to remove empty lines with or without whitespace in Python
I have large string which I split by newlines. How can I remove all lines that are empty, (whitespace ...
Read more >Controlling Whitespace and Empty Lines in Jekyll - Josh Dick
The empty lines are undesirable since they are unnecessary and they make the generated output uglier. The Solution. Here's my solution for ...
Read more >Configure editor to remove whitespaces in blank lines
Is it possible to configure an editor in pycharm to automatically remove whitespaces in blank lines and trailing whitespaces when saving...
Read more >Remove Empty Lines & Extra Spaces from Document Easily
How can we remove all empty extra lines from the code? ... this one matches new line character In short Remove lines that...
Read more >[QUES] Remove multiple white spaces and empty lines in a ...
My target is : To remove all unnecessary white spaces (Not between two words of a sentence) and to arrange them in their...
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
It should be fixed in 4.1.7 released an hour ago, please confirm
I think I found the source, the CJS build, during Rollup+Babel somehow omits the spread operator which changes the logic of the program. However, the ESM and UMD builds are fine! That threw me off track at the beginning… Only CJS, CommonJS builds are not working as intended. What’s crazy is that it’s a real bug somewhere in Babel, or rather its config… I’ll nail this very soon.
@SylannBin, thank you for flagging this up! I’ll write up an article what went wrong and publish and credit you for the find.
Again, sorry for the bug.
It’s a shitty situation, I did all my best, unit tests passed (on ESM), it’s just Babel and/or Rollup produced a bad output which they should not have produced. But I’m “responsible” for the library in the end… Do you see? The bundlers should not even allow broken code, they should be smart-enough to alert us! Anyhow, I plan to release a patch this weekend.
Sorry about this.