Skip to content

[Feature proposal] configurable class names #523

@davidDuymelinck

Description

@davidDuymelinck

I read the #102 issue for custom class names. But I found the solution a bit lacking.

disabling an existing module and adding your own plugin

If you want to change one class from a plugin, you need to copy paste the plugin and add the change. And what if you want to change 20 plugins?

So I forked the project and came up with a way to make all classes configurable. https://github.com/davidDuymelinck/tailwindcss

Basically I added a new key to the config object, modifyClassNames. The value of the key is an object which has the module names as keys.

Each module has a prefix and modifier key. The prefix has a string value. The modifier key is an object with a key from the plugin and as value the class name after the prefix.

modifyClassNames: {
   whitespace: {
        prefix: 'ws-',
        modifier: {
             normalWord: 'wrap-word-normal'
        }
   }
}

This example is for the class name that is now generated as break-normal.

For the modifier keys I wanted to stay as close to the style value as possible to make the configuration as easy as possible. An other example of this is the noDecoration key for the current class name no-underline.

I understand this is a nice to have for the maintainers. I just wanted to show the solution I came up with, to find out if there are other people who still want class name configuration included in Tailwind CSS?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions