-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Tailwind4 plugin - usage question #2
Comments
Each icon has multiple CSS rules. For example, for .material-symbols--open-in-full-rounded {
display: inline-block;
--svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M4 21q-.425 0-.712-.288T3 20v-6q0-.425.288-.712T4 13t.713.288T5 14v3.6L17.6 5H14q-.425 0-.712-.288T13 4t.288-.712T14 3h6q.425 0 .713.288T21 4v6q0 .425-.288.713T20 11t-.712-.288T19 10V6.4L6.4 19H10q.425 0 .713.288T11 20t-.288.713T10 21z'/%3E%3C/svg%3E");
background-color: currentColor;
-webkit-mask-image: var(--svg);
mask-image: var(--svg);
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
-webkit-mask-size: 100% 100%;
mask-size: 100% 100%;
} For other icons code is almost identical, the only difference is in value of When you use That causes a lot of duplication. Tailwind CSS cannot reduce it. For that reason, there is a cleaner syntax with common selectors moved to |
Moved issue to Tailwind 4 plugin repository. |
Hi, Thanks for commenting. I was able to use the following additional CSS:
I am not sure if programatically adding this is possible, but it certainly seems to be a nice workaround. Do you have any input on that. I expext when using icon-[] there is a similar logic under the hood.... If twice the classes are added I am sure also color mode could easily be supported (not needed in my project, but needs consideration on the library level) I purposely excluded all elements containing iconify classes so that this solution is backward compatible.... edit: Updated selector from starts with to contains |
Yes, that works too. Unfortunately, that cannot be done via plugin. |
Added the "workaround" from iconify/iconify-tailwind#2 so that people find the solution more easily
Hi,
I will start with having the plugin configured as following:
I am successfully able to use
icon-[material-symbols--open-in-full-rounded]
iconify material-symbols--open-in-full-rounded
However I do not understand why the following is not supported (The additional iconify class seems redundant in clean naming mode and it feels counterintuitive in tailwind to use both files):
material-symbols--open-in-full-rounded
(withouticonify
)material-symbols--[open-in-full-rounded]
/material-symbols-[open-in-full-rounded]
I would have expected instead of
iconify-color
to have something likematerial-symbols--colored--open-in-full-rounded
Using
Thank you!
The text was updated successfully, but these errors were encountered: