Simplifying Tailwind CSS: Defining Classes in a Separate File #10708
Alfred-Emmanuel
started this conversation in
Ideas
Replies: 2 comments
-
Nice Idea
|
Beta Was this translation helpful? Give feedback.
0 replies
-
How is this different from defining custom classes in a CSS file and using |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The objective of this proposal is to not have any tailwind inline and remember this is just an idea, other ideas are welcome to make it better
Introduction: Tailwind CSS is a popular utility-first CSS framework that allows developers to quickly and easily style HTML elements. However, one common criticism of Tailwind is that it can lead to verbose and cluttered HTML code that is difficult to read and maintain. In this article, I explore an idea for simplifying Tailwind CSS by defining classes in a separate file.
Problem: The verbosity of Tailwind classes can make HTML code hard to read and modify. Additionally, developers may have to repeat the same classes across multiple elements, leading to redundancy.
Solution: To solve this problem, I propose defining Tailwind classes in a separate file and linking that file to the HTML document. This approach allows developers to write and manage Tailwind classes separately from their HTML code, which can make it easier to maintain and modify the styles over time.
Implementation: To implement this approach, developers would need to create a separate CSS file that contains the Tailwind classes they want to use. They could then link this file to their HTML document using a tag in the head section of the document. In the HTML code, developers could apply the Tailwind classes to their elements using shorter and more descriptive class names.
Benefits: Defining Tailwind classes in a separate file can lead to several benefits, such as reducing the verbosity of the HTML code, making it easier to read and modify. Additionally, developers can avoid repeating the same classes across multiple elements, leading to more concise and maintainable code.
Conclusion: In this article, we have explored an idea for simplifying Tailwind CSS by defining classes in a separate file. By reducing the verbosity of the HTML code and making it easier to manage Tailwind classes, this approach can help developers create more efficient and maintainable web applications.
To further clarify incase there are any confusions. What I'm proposing is very similar to how the "root:" is used to create custom variables in CSS.
I will attach some images based off of some previous opinions by other people
![IMG_20230301_084441](https://user-images.githubusercontent.com/30597226/222076647-0701aed9-f651-432a-a24e-a5e2cb605a3b.jpg)
![IMG_20230301_084522](https://user-images.githubusercontent.com/30597226/222076681-562d1ae4-35bf-42c9-aeb3-da9216383e27.jpg)
![IMG_20230301_084631](https://user-images.githubusercontent.com/30597226/222076708-a04b446c-dc14-404c-90c2-fdad998330b5.jpg)
![IMG_20230301_084727](https://user-images.githubusercontent.com/30597226/222076745-b0dc065d-f97b-4d26-bc79-332036e1aad4.jpg)
Beta Was this translation helpful? Give feedback.
All reactions