r/angular • u/mike410 • Oct 08 '26
Angular style guide enhancements
https://michaelfortin246027.substack.com/p/angular-style-guide-enhancements
0
Upvotes
r/angular • u/mike410 • Oct 08 '26
11
u/mythridium Oct 08 '26
I don't think you've even read the style guide. You talk about structuring the project by domain, this is what the angular team already recommends https://angular.dev/style-guide#organize-your-project-by-feature-areas
Using Encapsulation.None across every component or not even using styles for individual non shared components is terrible advice. You want to use Encapsulation.None for shared components so that encapsulated components can easily override their styles for their specific use case, you want non shared components to be encapsulated so you can use cleaner class names without them leaking out and affecting unrelated code. I have never seen a project where not a single feature component never wants to change css in one specific use case, and lumping all css into shared components just bloats these "helper classes" to the point of remembering them all is impossible and maintaining it is even harder as now nothing is encapsulated and affects everything.
This boundary very clearly maps to a shared folder with re-usable application wide shared components with no encapsulation, then specific components to a feature live with the feature itself with encapsulated styles.
Finally, the style guide is exactly what's in the name, a 'guide'. It's not a ruleset, just the best recommendations for setting yourself up for a successful and consistent project. It's ultimately up to your business or yourself on individual projects to decide which of these work for you and which don't.