News for hackers. Stuff that matters.
Re:Inline CSS works better in a component world by wtf_srsly on Thursday August 20, 2020 @04:41AM (#24221218)
That you can't have inline pseudo elements, state selectors etc. There's a lot of stuff thats just possible with a proper css file / tags.
Re:Inline CSS works better in a component world by davnicwil on Thursday August 20, 2020 @05:41AM (#24221538)
Right - I mention this at the end of the article. By inline I'm not talking only about literally the style attribute but the inline, component-scoped pattern. For instance things like styled-components allow the full feature power of CSS classes, just inline rather than in the 'global' style.
Re:Inline CSS works better in a component world by somishere on Thursday August 20, 2020 @07:41AM (#24222204)
Ah, so you mean a scoped stylesheet included in the same file as the rest of your component markup. Agreed this is a useful pattern in the right circumstances! Depending on your build process (and how you're using components), in the old days this method just saw a global stylesheet deployed as usual, except with automated / custom scoping applied via data attributes. Do web components use shadow-dom style scoping now?
Re:Inline CSS works better in a component world by davnicwil on Thursday August 20, 2020 @09:01AM (#24222750)
> so you mean a scoped stylesheet included in the same file

Exactly - perhaps 'colocated styles' might be a better term than 'inline styles'.

> Do web components use shadow-dom style scoping now

Not sure, I don't use or know much about Web Components (the technology) - by 'component' I just mean the web framework pattern of modularising a bunch of markup/behaviour (and styles if you agree with the arguments in the article!)