html-crush request option breakToTheRightOf
slickdeals-jeff opened this issue · comments
Package's name
html-crush
Describe the solution you'd like
We have some business rules that would require forcing line breaks before and after some custom <custom_tag>tags</custom_tag>
Additional context
breakToTheLeftOf
is perfect for what we need but it is only half of our needed solution. An option breakToTheRightOf
would complete our needed functionality.
hi Jeff,
Good idea!
I need that myself, I'm even patching such functionality by manually finding-and-replacing certain tags with tag-plus-LF linebreak. The main challenge is, to achieve "breaking on the right" we need to correctly determine the boundaries of a tag, which is challenging, considering there can be ESP templating inside.
Currently, conceptually, we simply add or remove whitespace between >
and <
. So, algorithm is simple, I don't care what's the tag on the right. And no templating languages use >*<
pattern. But finding the closing bracket raises up the stakes by a magnitude.
Realistically, I'd deliver this feature by rewriting codsen-tokenizer in Rust so it's fast-enough to be driving the minifier. Or even better, write the minifier on top of that in Rust too, and ship a compiled CLI minifier.
Theoretically, Jeff @slickdeals-jeff , would you be able to use such CLI to achieve your email minification needs? (Let's say available via npm, but pre-compiled, like SASS-Dart ) Or does it have to be a native JS function, installed by npm
as a dependency package (as is now)?
CLI would work for me, I don't need it to be a native JS function. So, whatever makes the most sense to you, would work for me.
@revelt , I solved for my problem with some local regex coding. Don't feel obligated to build in this feature from my request
It's a hard decision but let's pass on this one. I'll close this, sorry and thank you for taking time to contribute.