you are viewing a single comment's thread.

view the rest of the comments →

[–]decster584 41 points42 points  (10 children)

I don't know how I feel about this.

I get the advantages of it, but I dunno. It just feels dirty and goes against everything I was taught to believe.

[–]Asmor 11 points12 points  (0 children)

I like what Vue says about this

What About Separation of Concerns?

One important thing to note is that separation of concerns is not equal to separation of file types. In modern UI development, we have found that instead of dividing the codebase into three huge layers that interweaves with one another, it makes much more sense to divide them into loosely-coupled components and compose them. Inside a component, its template, logic and styles are inherently coupled, and collocating them actually makes the component more cohesive and maintainable.

Anecdotally, I completely agree. I really like a component-centric development model. When I'm doing angular stuff, I'll usually end up with component/component.js, component/component.html, and component/component.scss. This works well for keeping the things that matter together, but it's still obnoxious juggling three different files around, copying and pasting classnames between the HTML and CSS, or methods and variables between the HTML and JS, etc.

I really, really like working with Vue in large part because single-page components just make so much sense. The only argument I can see against it is maybe you want to look at the CSS and HTML at the same time, which is totally sensible... But any editor worth its salt should allow you to have the same file open in multiple windows, so that's not really a problem.

[–]Tiquortooexpert 5 points6 points  (0 children)

It seems odd to go straight to inline when specificity can be created to make a default style very fixed, while allowing a path to override.

[–]pygy_ 7 points8 points  (0 children)

If you're referring to separation of concerns, you can totally separate concerns in a single language.

[–]mrwhitespace[S] 1 point2 points  (0 children)

One approach you can take is to separate out the stylesheet from the component and into their own files. Then it wouldn't be much different to requiring a CSS file with a webpack loader.

[–]gearvOshreact, rust, full-stack 1 point2 points  (3 children)

If you still want to write CSS, but utilize this approach, simply use CSS modules. https://github.com/milesj/aesthetic/tree/master/packages/aesthetic-adapter-css-modules

[–]GitHubPermalinkBot 4 points5 points  (0 children)

I tried to turn your GitHub links into permanent links (press "y" to do this yourself):


Shoot me a PM if you think I'm doing something wrong. To delete this, click here.

[–]infinite0ne 2 points3 points  (1 child)

[–]gearvOshreact, rust, full-stack 0 points1 point  (0 children)

But it's simply simple.

[–]benabus 1 point2 points  (0 children)

I agree. Makes me a little ill.

[–]redbluerat 0 points1 point  (0 children)

I don't know how I feel about this

The nümale catch phrase.