Inline Custom Class Generation #12814
alexander-schranz
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using tailwind a lot in PHP Template Engines like Twig. And sometimes I would really like to avoid so many classes on my atoms components as they make my HTML really big when appearing a lot of times.
Example I have a button component which has a lot of classes on it.
Instead I would really like without have to switch to a CSS file generate a custom class example by wrapping the class in a
class()
method e.g.instead of:
it would maybe be:
I'm not sure what yet the right cross syntax could be, so it works in JS based Applications, PHP Template Engines and so on but it will basically generate something like this:
And I could then use
<button class="button--primary">
. What sure need to keep in mind thatbutton--primary
could only exist in a single location and not multiple times in the same build. Another possibility is that maybebutton--primary
is optional and instead ahash
algorithm is used over the classes, which could implemented via a Template Engine Extension / Function to get the correct hash based class.Beta Was this translation helpful? Give feedback.
All reactions