0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-03-17 23:11:29 -05:00

Use IE conditional comment placeholders for server island start markers (#12090)

These placeholders are much less likely to be removed by HTML minifiers,
because they have traditionally been used to change the behavior of
site.
This commit is contained in:
Mark Jaquith 2024-10-01 15:58:14 -04:00 committed by GitHub
parent 11d447f66b
commit d49a537f2a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Server islands: changes the server island HTML placeholder comment so that it is much less likely to get removed by HTML minifiers.

View file

@ -47,7 +47,7 @@ export function renderServerIsland(
}
}
destination.write('<!--server-island-start-->');
destination.write('<!--[if astro]>server-island-start<![endif]-->');
// Render the slots
const renderedSlots: Record<string, string> = {};
@ -88,7 +88,7 @@ if(response.status === 200 && response.headers.get('content-type') === 'text/htm
// Swap!
while(script.previousSibling &&
script.previousSibling.nodeType !== 8 &&
script.previousSibling.data !== 'server-island-start') {
script.previousSibling.data !== '[if astro]>server-island-start<![endif]') {
script.previousSibling.remove();
}
script.previousSibling?.remove();