I'm close to relaunching an ambitious remake of one of my oldest #Drupal projects and as part of my approach, I went in hard on Single Directory Components (SDC).

The opinionated advice on these Components is that everything should be one. Stop using anything but components. After slogging through a very complex project attempting to follow that advice, I've come to disagree.

What's great about SDCs is they encapsulate just about everything about an element within a single folder for easy reference, but it's a pipe dream to think we're ever going to be able to keep *everything* so tidy.

Consequently, making everything a component defeats the purpose. It creates a fog of excess code and makes it hard to identify what really matters.

My conclusion about best practices (for full stack developers) with SDC is that you shouldn't use them when there's no reason to use one. I really like the added options I have in structuring my sites with them, but the benefits are lost when taken to extremes.

#webdev #php

@sysop408 thanks for sharing your take. Did you settle on a balance? When sdc gave you a tangible benefit (while developing and/or maintaining them)

@joelpittet I think the next site I build from scratch, I'm not going to start with everything as an SDC. I'm going to start with everything as a Twig template and convert them into SDCs once I identify a good use case to encapsulate it.

I can see why it would make sense for teams to go the everything is a component approach because it adds additional testing, design, and storybooking options. For a solo project, it makes no sense to abstract a Twig template in cases where the SDC is doing the exact same job, but with a lot more code.

I'm definitely getting good mileage out of using SDCs for serving display modes and page widgets. I really like how I can combine Views and Twig blocks as preprocessing steps to deliver perfectly formatted content to the SDCs.

Views is a great query engine, but not a great layout engine. This combo unlocks a lot of easy ways to assemble complex layouts in #Drupal.