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

Tailwind Class Prefix for components #1268

Open
juliankolbe opened this issue Mar 3, 2024 · 0 comments
Open

Tailwind Class Prefix for components #1268

juliankolbe opened this issue Mar 3, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@juliankolbe
Copy link
Contributor

Summary

Adding a prefix to the tailwind config will prefix all tailwind classes and all flowbite classes. Then when using normal tailwind in svelte its easy (while still tedious) to prefix the classes yourself.

It is however not possible to prefix the tailwind classes used by the flowbite-svelte components. Component classes can only partially be modified to use the prefix by overwriting all classes available via props, but all the other classes are not accessible.

It is also not nice DX to have to overwrite every class manually even if it was possible.

Step to fix this

twMerge can be extended to allow prefixes like so:

import { extendTailwindMerge } from "tailwind-merge";

export const twMerge = extendTailwindMerge({
  prefix: "tw-",
});

In addition, there needs to be some config + functionality that add the prefix to every class that's being used.
I don't know all the steps to achieve this, but having it would be great.

Motivation

The Motivation should be clear, to avoid clashes with other tailwind classes when they collide. Which is real problem sometimes.

@juliankolbe juliankolbe added the enhancement New feature or request label Mar 3, 2024
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

1 participant