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

Add @prefix at-rule for prefixing classes #100

Closed
wants to merge 1 commit into from

Conversation

adamwathan
Copy link
Member

This PR adds a new custom @prefix at-rule which works as a decorator for prefixing any nested class definitions:

@prefix 'tw-' {
  @tailwind utilities;
}

This makes it easy to generate all of Tailwind's utilities with a user-provided prefix to avoid collisions with any existing CSS they are using

@ghost
Copy link

ghost commented Nov 5, 2017

I love this idea, this would also close #92!

Also, why use an at-rule rather than a configuration option?

@regularlabs
Copy link

Maybe have both?
So a general prefix configuration option too.
If you set the configuration prefix option to foo- an then wrap stuff in @prefix 'bar-' {}, the classmames would become foo-bar-....

@adamwathan
Copy link
Member Author

Also, why use an at-rule rather than a configuration option?

Right now the config file doesn't contain any real "settings" or anything so to speak; it's more of a style guide or a definition of your design system.

Adding this there would make it the first time we've added that sort of configuration to that file and I'm not convinced I want to start mixing those two types of configuration in the same place.

Open to discussing it though; it would likely affect #99 as well, and any other proposals about "settings" like this, like tailwindlabs/discuss#27.

@regularlabs
Copy link

Mixing the style stuff with possible setting might indeed not be a good idea.
Solution could be to have them in a separate (optional) file.
Once you have the mechanism to control stuff with settings, you can think of all sorts of cool stuff to put in there in the future.

@regularlabs
Copy link

A different setting could be to control the format of the responsive prefixes (like mentioned in tailwindlabs/discuss#27), but also to choose whether to use that as a prefix or suffix.

Maybe settings to control LTR/RTL stuff.

@adamwathan
Copy link
Member Author

After a bunch of discussion I think we're going to do this in the config file. Gonna let this hang open until we get that implemented though.

@adamwathan
Copy link
Member Author

Closing this in favor of the config-based approach in #183.

@adamwathan adamwathan closed this Nov 14, 2017
@adamwathan adamwathan deleted the prefix-directive branch November 23, 2017 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants