You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, I am playing around with TailwindCSS and I came across with a sweet idea, but I don't think is possible in TailwindCSS. Nonetheless, I want to share it here to see if someone has an answer and to give some ideas for the future of TailwindCSS.
I know that TailwindCSS is a free software and I don't have any right to request anything. This post is more related to share my opinion and giving a few ideas. And also, maybe I am completely wrong and this post is useless as Tailwind already supports what I want to expose 😄
The problem
I would like to use a class like <ul class="nth-[2]:text-blue-300></ul>. As this is custom, I would need to create a tailwind CSS plugin, but I don't think I can...
Demo with UnoCSS
I created a quick rule with UnoCSS, so you can see here what I want to achieve
The problems I found
1. Custom selectors
There is no way to change the default selector that Tailwind uses, right?
TailwindCSS is adding the class selector .html_bg-\[pink\] at the beginning which I don't want. With the plugin I return:
html: {
backgroundColor: value
}
Then, I expect as an output html {... and not .html_bg-\[pink\] html {...
2. Arbiatry modifiers
Another thing is that matchUtilities have shown how powerful they are, but atm, if I am not wrong, we don't have something like matchModifiers which would be the next step in my opinion.
Arbiatry modifiers will be handful in different scenarios like:
nth-[even]:bg-pink-100 or nth-[5]:text-blue-500
Creating a custom selector like: [:root]:[--primary:white] or hover:[h1,h2]:text-pink
Support for pseudo-elements like :has or :is: [&:has(p.blue)]:mt-20Here & is the element itself
Instead of the use of classes, a new plugin could support attributes like preset-attributify for UnoCSS
Named groups: group-[custom-name]
Probably there are more cases, but these are the one I can think for now.
As I said, I am no one to be asking for anything and you probably have a super long todo lists, but changing these two things, I believe, it will allow Tailwind to be a super flexible CSS framework like UnoCSS
This is the end, thanks for reading 🙌 and keep up the great work @tailwind team!!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey, I am playing around with TailwindCSS and I came across with a sweet idea, but I don't think is possible in TailwindCSS. Nonetheless, I want to share it here to see if someone has an answer and to give some ideas for the future of TailwindCSS.
The problem
I would like to use a class like
<ul class="nth-[2]:text-blue-300></ul>
. As this is custom, I would need to create a tailwind CSS plugin, but I don't think I can...Demo with UnoCSS
I created a quick rule with UnoCSS, so you can see here what I want to achieve
The problems I found
1. Custom selectors
There is no way to change the default selector that Tailwind uses, right?
Here is a stupid scenario but it does not work as (I would like to be) expected: https://play.tailwindcss.com/1wAZrHeEXF?file=config
TailwindCSS is adding the class selector
.html_bg-\[pink\]
at the beginning which I don't want. With the plugin I return:Then, I expect as an output
html {...
and not.html_bg-\[pink\] html {...
2. Arbiatry modifiers
Another thing is that
matchUtilities
have shown how powerful they are, but atm, if I am not wrong, we don't have something likematchModifiers
which would be the next step in my opinion.Arbiatry modifiers will be handful in different scenarios like:
nth-[even]:bg-pink-100
ornth-[5]:text-blue-500
[:root]:[--primary:white]
orhover:[h1,h2]:text-pink
:has
or:is
:[&:has(p.blue)]:mt-20
Here & is the element itselfpreset-attributify
for UnoCSSgroup-[custom-name]
Probably there are more cases, but these are the one I can think for now.
As I said, I am no one to be asking for anything and you probably have a super long todo lists, but changing these two things, I believe, it will allow Tailwind to be a super flexible CSS framework like UnoCSS
This is the end, thanks for reading 🙌 and keep up the great work @tailwind team!!
Beta Was this translation helpful? Give feedback.
All reactions