Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fonts per CSS file #38

Open
royduin opened this issue Oct 18, 2024 · 1 comment
Open

Fonts per CSS file #38

royduin opened this issue Oct 18, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@royduin
Copy link

royduin commented Oct 18, 2024

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.

@Log1x
Copy link
Owner

Log1x commented Nov 12, 2024

I think we'd have to wait on vitejs/vite#18392 but this would definitely be nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants