Post

TIL: Minifying the output HTML of a Svelte build is a bad idea 🤔 I noticed HEAD elements were getting duplicated and I couldn't figure out why. Turns out Svelte actually uses comments in the markup to handle updates without duplication! So I broke it by removing them 😅 github.com/sveltejs/sve...

github.comDuplicate `head` elements occur when html comments are stripped · Issue #8112 · sveltejs/svelteDescribe the bug The solution to the duplicate content svelte:head element bug (and also this one) requires HTML comments to be present in order to function correctly. Many minification tools strip...

The Github issue mentions turning off Cloudflare auto minify, but I believe that has been deprecated 🤔 In my case it was my own fault - I added a build step to minify the HTML back when I was using 11ty and I kept it after the rewrite to Svelte. I never thought it would be an issue 🤷

0 reposts1 like

No replies yet.