head icon indicating copy to clipboard operation
head copied to clipboard

Option for ordering in head? font faces loaded before fonts are loaded, results in annoying warning

Open awacode21 opened this issue 2 years ago • 7 comments

Is there any option to define an order of the head stuff? Or to define specific stuff to be loaded at the end of head?

I have the problem, that i use vueuse/head for my font face definitions in style tag and also for preloading of the fonts. But the font faces get loaded before the fonts. That results in following warning

Bildschirmfoto 2022-03-14 um 10 22 28

Because there is no font face definition AFTER the font loading. It can be fixed when the style tag with font face definition is at the very end of head. But i don't find a configuration how to achieve this with vueuse/head.

I think there are use cases where the order in the head can be important.

Note: using vueuse/head with SSR

awacode21 avatar Mar 14 '22 09:03 awacode21

maybe you can ensure for the ordering in the head that files with preloading come first?

awacode21 avatar Mar 24 '22 20:03 awacode21

Any feedback on this? @antfu

awacode21 avatar Jul 04 '22 09:07 awacode21

@antfu I'm getting bit by this issue too. I am inserting theme CSS files with useHead but they are ending up at the bottom of the head element, so they are overriding things like Tailwind. Need some sort of option to put things at the top of the head in my case.

JohnCampionJr avatar Sep 02 '22 12:09 JohnCampionJr

PR welcome and I will review.

antfu avatar Sep 03 '22 06:09 antfu

See https://github.com/vueuse/head#render-priority

If you're server-side rendering then it should solve it. Feel free to re-open the issue if you need non-SSR support

harlan-zw avatar Sep 19 '22 03:09 harlan-zw

@harlan-zw first... thank you!!! i think i need both, server side and client side support. When i check what's delivered by the server it's looking good, but than on client side it is still the other way round and still with the console warnings.

awacode21 avatar Sep 19 '22 14:09 awacode21

Hm okay thanks for the feedback, I'll re-open this

The issue why it's SSR only is that the patching nodes with ordering client side is not possible without doing some re-engineering of how the DOM updates work, I'll see what I can do

harlan-zw avatar Sep 19 '22 14:09 harlan-zw

With any of the v1 RC versions, the client side can also be ordered.

Going to close, let me know if you have any issues with it.

harlan-zw avatar Oct 25 '22 03:10 harlan-zw