Why you should build your own CSS framework and what I learned building one

With the rise in utility-first CSS libraries, I wanted to dive deeper into why that’s the case, and why we I think it’s valuable to re-invent the wheel.
Since many mainstream frameworks include kilobytes of never used CSS and tons of styles that need to be overridden, it’s not hard to see how most frameworks do too much, adding unnecessary bloat and slowing page speeds. But beyond heavy frameworks like Bootstrap, there are a rising number of utility-first frameworks, such as Tailwind, that don’t have the bloat and customization issues like Bootstrap and their counterparts1. Plus, with tools like Sass and modern utilities like CSS flexbox and grid, it’s never been easier to build custom frameworks.
With this in mind, I sought to create a replacement–one that also passes Google’s Lighthouse and that has my own personal flair.
So, why reinvent the wheel?
Oftentimes, I found the best way to learn is to do things on your own. While our individual implementations might not be as advanced, I think it’s enlightening to go through the process without a framework and discover the rationale behind the design choices.
For instance, building my own remake of TailwindCSS made me appreciate the unique quirks of Tailwind’s mobile-first approach to responsive styles. By having having mobile styles as the base and layering on styles for devices of increasing power, Tailwind encourages developers to make design decisions that help mobile devices take less processing time for media queries.
In addition, through struggling to scale my own framework with numerous css classes, I’ve discovered important discussions on conventions like BEM or SUIT. Furthermore, I’ve also learned about common solutions to widespread problems like clearfix for layouts built with floats that I wouldn’t have found otherwise. Without creating my own tools, I might not have stumbled upon such ideas.
Takeaways
Building your own framework can help you:
- Gain a greater appreciation for what they try to solve
- Discover new discussions of which you were previously unaware
- Broaden your understanding of the fundamentals
To conclude this post, I challenge you to build your own CSS framework, and I encourage you to share what you learned.
Well, that is if you use PurgeCSS, as described on the Tailwind docs ↩
related posts
Why life needs entrepreneurial thinking: How making goals is like starting a business
I think that a lot of what entrepreneurs do is applicable to everyone. Our keen ability to find flaws in the status quo and then to take that initiative to...
Midway Through the Years
Midway changed a lot from its humble beginnings as a simple prototype to the complex extension it is now. Let’s explore how it changed. Check out the latest version of...
Why I don't have New Year's resolutions
It’s that time of year when everyone asks about their New Year’s resolutions. While I like the rationale, personally, I don’t think it works. Here’s why.
must-reads
Towards Efficient Multiplication
Recently, I was trying to figure out a way to create my own arbitrary precision floating point arithmetic library. For those of you unaware, floating point simply means numbers are...
Why I don't have New Year's resolutions
It’s that time of year when everyone asks about their New Year’s resolutions. While I like the rationale, personally, I don’t think it works. Here’s why.
Why life needs entrepreneurial thinking: How making goals is like starting a business
I think that a lot of what entrepreneurs do is applicable to everyone. Our keen ability to find flaws in the status quo and then to take that initiative to...
What I learned winning 3rd place at StuyHacks IX: Misconceptions about Hackathons and Tips for Success
I’m often surprised by the grand expectations that younger coders believe is necessary for success at Hackathon events. Here, in no particular order, are some of the most common misconceptions...