Open luoxiaozero opened 1 week ago
It seems like there are multiple people interested in having the ability to inject things into the <head>
where leptos_meta
does it, while also modifying the behavior of the relevant components pretty signficantly. (See #2856, #3188) It would be helpful to unite these different ideas into one set of extensions to leptos_meta
.
I think at least #2856 and this seem to result from the fact that the pre-0.7 leptos_meta
components have side effects — simply creating a <Style>
, without every using it in the view that is returned, injects something into the <head>
. It seems like your implementation above relies on this behavior. (i.e., mount_style
does not return a view that should be rendered, but ()
— it is purely side effects)
I don't think I fully understand either the use case for what you're trying to do, or what you're asking for, though.
Is your feature request related to a problem? Please describe.
Currently I inject css into head via
Style
in SSR mode, and control css via custom logic in Hydrate mode.When I hydrate via the following code,
<Style>". b {}"</Style>
gets hydrated to the<style>". a{}"</style>
element instead of the<style>". b{}"</style>
element.Describe the solution you'd like
Public leptos_meta::register function. Allows passing a second parameter to control the position of the generated HTML string to avoid hydration.
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context
RegisterConfig
is a struct in order to expand more fields in the future to achieve the same functions as unhead.