Skip to content

Support custom tailwind prefix #135

@UnknownPlatypus

Description

@UnknownPlatypus

For projects that have class names that conflict with Tailwind CSS utilities, you can prefix all Tailwind-generated classes and CSS variables using the prefix option.

It seem currently rustywind ignores these, so it does not sort most of the classes. Would it be difficult to support this ?

Below some details about the syntaxes for v3 and v4 ⬇️


Tailwind v3

Tailwind v3 prefix docs

<div class="tw-text-lg md:tw-text-xl tw-bg-red-500 hover:tw-bg-blue-500">
  <!-- -->
</div>

Tailwind v4

Tailwind v4 prefix docs

<div class="tw:text-lg tw:md:text-xl tw:bg-red-500 tw:hover:bg-blue-500">
  <!-- -->
</div>

The main difference between v3 prefixes and v4 prefixes is that in v3, the prefix was part of the utility where as in v4 it is _always in front of the CSS class.

So, for example, this in v3:

hover:-tw-mr-4
tw-text-lg

Would be converted to the following in v4:

tw:hover:-mr-4
tw:text-lg 

Relevant tailwind pr's:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions