You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
useAssets relies on <head> to inject its markup, which feels off where in some cases some users would just render from the an specific root instead of the whole document, which also applies to Islands.
It would be helpful if useAssets doesn't rely on such mechanism. For instance, in my JSX library, stellis, I run the following checks:
if the resulting markup is an HTML markup
if the markup has a head
Match the opening head element and insert pre-<head> content
Match the closing head element and insert post-<head> content
if the markup has no head
Concat both pre and post <head content and wrap it in a <head> markup then insert it before the HTML opening element.
if the markup has a body
Match the opening body element and insert pre-<body> content
Match the closing body element and insert post-<body> content
if the markup has no body
Create a <body> opening, append the pre-<body> content and insert it after </head>
Create a <body> closing, prepend the post-<body> content and insert it before </html>
if the resulting markup isn't an HTML markup (partial render)
if the markup has a body
Match the opening body element and insert pre-<body> content
Match the closing body element and insert post-<body> content
if the markup has no body
if the markup has no head
Insert the pre and post <body> content on both ends of the markup
if the markup has a head
Match the opening head element and insert pre-<head> content
if the markup has no body
Match the closing head element and insert post-<head> and pre-<body> content
Append post-<body> content to the markup
if the markup has no head
Prepend both pre and post <head> content to the markup
useAssets
relies on<head>
to inject its markup, which feels off where in some cases some users would just render from the an specific root instead of the whole document, which also applies to Islands.It would be helpful if
useAssets
doesn't rely on such mechanism. For instance, in my JSX library,stellis
, I run the following checks:<head>
content<head>
content<head
content and wrap it in a<head>
markup then insert it before the HTML opening element.<body>
content<body>
content<body>
opening, append the pre-<body>
content and insert it after</head>
<body>
closing, prepend the post-<body>
content and insert it before</html>
<body>
content<body>
content<body>
content on both ends of the markup<head>
content<head>
and pre-<body>
content<body>
content to the markup<head>
content to the markupHere's the implementation:
https://github.com/lxsmnsyc/stellis/blob/main/packages/stellis/src/index.ts#L163-L231
I would love to know what you think about this
The text was updated successfully, but these errors were encountered: