DEV Community

Cover image for What are your reusable parts of code for js and scss?
Matek
Matek

Posted on

What are your reusable parts of code for js and scss?

Top comments (1)

Collapse
 
guitarino profile image
Kirill Shestakov

Most of my code is reusable. Recently I've been splitting code in roughly 2 categories: small reusable modules (~90% of code), and connectors, which are sometimes big, but really dumb modules, whose purpose is to connect reusable modules together and provide dependencies. Connectors could be easily thrown out, rewritten, copy‐pasted, duplicated with changes, etc, because they don't contain much logic. This kind of setup allows you to structure your code in many different ways, for many different environments at once, quickly restructure for a new environment, provides good testability, etc. And yes, a lot of my small modules are reused, e.g. for testing or to run in multiple places or multiple environments (e.g. both client side and server side).