Add Less

When you’re about to start a new website, what do you think first? Do you start with a library or framework you know, like React or Vue, or a meta-framework on top of that, like Next or Nuxt? Do you …


This content originally appeared on CSS-Tricks and was authored by Cassidy Williams

When you’re about to start a new website, what do you think first? Do you start with a library or framework you know, like React or Vue, or a meta-framework on top of that, like Next or Nuxt? Do you pull up a speedy build tool like Vite, or configure your webpack?

There’s a great tweet by Phil Hawksworth that I bookmarked a few years back and still love to this day:

Your websites start fast until you add too much to make them slow. Do you need any framework at all? Could you do what you want natively in the browser? Would doing it without a framework at all make your site lighter, or actually heavier in the long run as you create or optimize what others have already done?

I personally love the idea of shipping less code to ultimately ship more value to the browser. Understanding browser APIs and what comes “for free” could actually lead to less reinventing the wheel, and potentially more accessibility as you use the tools provided.

Instead of pulling in a library for every single task you want to do, try to look under the hood at what they are doing. For example, in a project I was maintaining, I noticed that we had a React component imported that was shipping an entire npm package for a small (less than 10-line) component with some CSS sprinkled on top (that we were overriding with our own design system). When we re-wrote that component from scratch, our bundle size was smaller, we were able to customize it more, and we didn’t have to work around someone else’s decisions.

Now, I’m not saying you shouldn’t use any libraries or frameworks or components out there. Open source exists for a reason! What I am saying is to be discerning about what you bring into your projects. Let the power of the browser work for you, and use less stuff!


This content originally appeared on CSS-Tricks and was authored by Cassidy Williams


Print Share Comment Cite Upload Translate Updates
APA

Cassidy Williams | Sciencx (2021-12-30T16:23:29+00:00) Add Less. Retrieved from https://www.scien.cx/2021/12/30/add-less/

MLA
" » Add Less." Cassidy Williams | Sciencx - Thursday December 30, 2021, https://www.scien.cx/2021/12/30/add-less/
HARVARD
Cassidy Williams | Sciencx Thursday December 30, 2021 » Add Less., viewed ,<https://www.scien.cx/2021/12/30/add-less/>
VANCOUVER
Cassidy Williams | Sciencx - » Add Less. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/12/30/add-less/
CHICAGO
" » Add Less." Cassidy Williams | Sciencx - Accessed . https://www.scien.cx/2021/12/30/add-less/
IEEE
" » Add Less." Cassidy Williams | Sciencx [Online]. Available: https://www.scien.cx/2021/12/30/add-less/. [Accessed: ]
rf:citation
» Add Less | Cassidy Williams | Sciencx | https://www.scien.cx/2021/12/30/add-less/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.