maizzle / framework

Quickly build HTML emails with Tailwind CSS.
https://maizzle.com
MIT License
1.2k stars 48 forks source link

Transformer "removeUnusedCSS" add unwanted line break in large build file #1305

Closed Frolipon closed 1 month ago

Frolipon commented 1 month ago

I found that when using the transformer removeUnusedCss on very large files (several thousands lines of code in the build file), some unwanted line-breaks does appear in the middle of lines. Weirdly, the line-break does not appear at the same line for my colleague (but it does appear). For me it's around line 5455, and for hime around line 5980). I tried adding a few lines or a few characters, but the problem still does appear at the same position in code (so a few lines down). The project has a lot of components. If I switch the position of the components where the problem appears (let's call it component A) with another component (let's call it component B), then the problem appears in component B Capture d'ecran 2024-07-24 a 13 46 43

I didn't enable prettify

cossssmin commented 1 month ago

Hmm could there be something in that component that is tripping up email-comb? (what we use for CSS purging)

Have you tested with just that component in isolation? If it still happens, there's definitely something email-comb doesn't like, we could try to identify the character/sequence and let the author know 👍

Btw, if your project has lots of components you'll love Maizzle 5, it's orders of magnitude faster in local dev when saving changes to a component ;)

Frolipon commented 1 month ago

I don't think so.

If I have something like:

<component_a />
<component_b />
<component_c />
<component_d />

The problem will appear in the build file somewhere in the code of <component_d />

But if I write this:

<component_d />
<component_b />
<component_c />
<component_a />

then the problem will show in in the build file somewhere in the code of <component_a />

So I my best guess is that there is a point where there is too much characters and a line-break is inserted, but I could be wrong.

And about Maizzle 5, that's mean. Now I'm super excited about it and can't wait to try it 🤩

cossssmin commented 1 month ago

Might be worth opening an issue with email-comb, though it's a pretty rare scenario so I wouldn't get my hopes up too high... nothing we can really do about it on our side, sorry.