marko-js / vite

A Marko plugin for Vite
MIT License
55 stars 8 forks source link

Expose a tag to render vite assets #55

Open AngusMorton opened 1 year ago

AngusMorton commented 1 year ago

Description

Sometimes it's worth customising where the asset tags are rendered in the head if you need to wait for an API response to render SEO meta tags and want the client to start loading assets. The webpack bundler integration seems to support this through the <webpack-assets> tag, but the Vite integration doesn't have a similar public API.

It's currently possible using an internal API, out.global.___viteRenderAssets, but we should consider exposing a tag that behaves similarly and is documented.

Possible Implementation & Open Questions

Expose a <vite-assets> tag that causes assets to be rendered in its place instead of at the end of the head.

Is this something you're interested in working on?

I'm happy to try this if someone can point me in the right direction!