4 ms·
"Separation of concerns" often results is code rot and harder to main codebases. Placing the styles, js and HTML for a "component" in close proximity helps to r
by samwillis 4y ago
"Separation of concerns" often results is code rot and harder to main codebases. Placing the styles, js and HTML for a "component" in close proximity helps to reduce this and can in my experience make development significantly quicker.
Separate css style sheets make sense for "document" web pages, but for "applications" I have found keeping the style close to, or inline with, the HTML much better.
Personally I prefer the concept of the "single file component" popularised by Vue. Having one file that contain the js, HTML and css in close proximity but not on top of each other works really well.
A common phrase used to describe this is "locality of behaviour".
- greenie_beans 4y agoyeah i've never been a fan of separating html, css, and javascript. it's a dogma that doesn't work well for frontend development.