arnoson/kirby-vite

Is there an easy way to get the paths in the manifest JSON

Closed this issue · 2 comments

First of all, thanks for your plugin! Great work!

In a current project I have the case that I would like to preload a few assets. Especially font files to optimize for CLS.

At the moment I access the path via this code, which is unfortunately very verbose and thus not very secure:
/dist/{{ vite().manifest()["fonts/font-name.woff2"]["file"] }}

Would it make sense to add a public function that returns the absolute path for a resource?

Glad you like the plugin!
Seems like a good idea, maybe something like vite()->file(...). Do you want to create a PR? Otherwise I can look into this later this week.

Thanks for the feature and the quick release!