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

Only include css of components that are being used #1361

Open
gregg-cbs opened this issue Jun 14, 2024 · 2 comments
Open

Only include css of components that are being used #1361

gregg-cbs opened this issue Jun 14, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@gregg-cbs
Copy link

Summary

When doing the following in the tailwind.config.js the general css file size tripples.
content: ['./node_modules/flowbite-svelte/**/*.{html,js,svelte,ts}'],

It looks like this is including all components css even if components arent being used. This means the browser is downloading the entire flowbite library worth of components tailwindcss without needing it.

It would be nice if we could leverage tailwinds class shedding to only include css of components we use, when we use them.

Motivation

Lighthouse is complaining about unused css. The css file size is 150kbs, naturally its 50kbs. Its not a crushing change but it is something to note that is happening and i hope we can look into it at some point.

@gregg-cbs gregg-cbs added the enhancement New feature or request label Jun 14, 2024
@shinokada
Copy link
Collaborator

Did you read this?

@gregg-cbs
Copy link
Author

Good find and thanks for sharing. I think that information should be part of the setup documentation, i dont think anyone wants extra bloated css?

Also this seems to shed a couple kbs but not as much as I was hoping. I will look into this.

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