I use html-minifier for emails, and some mail servers automatically add a new line after 1000 caracters. This behaviour breaks html structure.
For example :
It could be great if we can add an option to limit the line size without breaking the html.
Do you think this is possible ?
@In4matik I knocked out a super-basic version of this functionality here.
It's a bit kludgy though I have some ideas about how to improve it, but it should basically accomplish what you're after.
I tested it against the source of this page with a maxLineLength setting of 900, and collapseWhitespace true, and this was the result.
@duncanbeevers Looks pretty good! I'm only concerned about performance implications. Could you run node ./benchmark.js locally, and compare average time (reported at the end)?
Wow. Seems great @duncanbeevers !
I haven't time to test it, but I will ! Thanks.
Benchmark output here run with gh-pages as-is, then with limit-line-length but not limiting lines, and finally with a maxLineLength of 500.
Speed looks pretty stable, variance seems insignificant.
Ok, let's get it in. Can you send a PR? Thanks.
Sure. I was thinking of poking at this some more to get better-compressed results.
For example, right now it maximally-compresses
<a class="hey">link link</a>
I think the best we can hope for is this:
But that's a fish to fry another day!
I think this issue can be closed. If we want to pursue more aggressive splitting, I suggest we address that with another more-focused PR.