5 ms·
How do you re-use CSS across components?
by barryhoodlum 9y ago
How do you re-use CSS across components?
- rich_harris 9y agoThat's one of the unresolved questions. A couple of possible solutions: * have a small global stylesheet with styles that are common to many components * put the styles in a mutual parent component and opt-in to the cascade with the :global(...) modifier (from CSS modules) * you don't. This is often the answer I prefer. DRY code is less flexible, and I've often found it far better to have some duplication 5 minutes before I ship rather than be desperately trying to change some CSS on this component without also affecting those components But yes, this is an area we still need to work on.
- madeofpalk 9y agoCSS Modules has composes https://github.com/css-modules/css-modules#composition https://github.com/css-modules/css-modules#composition