Fonts per CSS file
Just curious about your thoughts on this; currently all fonts from the manifest are added with @preloadFonts. So when you've multiple CSS files (for multisite):
export default defineConfig({
plugins: [
laravel({
input: [
'resources/css/website1.css',
'resources/css/website2.css',
'resources/css/website3.css',
'resources/js/app.js'
],
And within the <head> something like:
@vite([
'resources/css/website.' . $websiteId . '.css',
'resources/js/app.js'
])
@preloadFonts
With different fonts in the CSS files on all websites you'll get all fonts. From the manifest you can't relate the fonts to a file so the achieve that you've to scan the CSS files again, or Vite does have something for that? But then @preloadFonts needs to know the CSS file to scan for fonts; @preloadFonts('resources/css/website.' . $websiteId . '.css') but maybe hooking into @vite so we don't need an extra directive would be cleaner. Not sure how Vite scans the CSS for fonts, but we've to repeat that from PHP.
I think we'd have to wait on https://github.com/vitejs/vite/issues/18392 but this would definitely be nice.