4 ms·
Why on earth would you specify your styling in your JS ?
by krzepah 6y ago
Why on earth would you specify your styling in your JS ?
- deleted 6y ago[deleted]
- crooked-v 6y agoBeing able to dynamically supply theming is a big one. For example: const Header = styled('header')` font-family: ${({ theme }) => theme.fonts.header}; color: ${({ theme }) => theme.colors.primary}; backgroundColor: ${({ theme }) => theme.colors.primaryBackground}; ` ...where the theme object can be swapped out on the fly for different sections of a web app.
- krzepah 6y agoThanks i haven't thought about that one. But i'd definitely try to stick up to css even if I'd have to dev that feature. Maybe by trying to change the var(--color) i've setup in my colors.css ; I'd note out that this feature is also so edgy that the pushed argument shouldn't even occur that much. It would be like "Oh hei, I need to dig up that super edgy star shaped hole using that shovel so I'm using it that way. Oh see, when I use it that way i'm inclined to do X. Therefore my shovel is encouraging me to do X."
- crooked-v 6y agoIt's only an edge case until you handle white-labeling services for other companies, at which point you immediately need a way to conveniently tweak the styling of everything in your web app per white-label client, preferably in a database-supplied way so that your support team doesn't have to handle every adjustment said client wants to make.