Skip to content

Fonts per CSS file #38

@royduin

Description

@royduin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions