ID vs. Class?
ericclemmons opened this issue · 1 comments
Would it be worth adding an option for the output styles to prefix an ID (e.g. #Style-4n412lnmi
) instead of a class (.Style-4n412lnmi
)?
Scenario being, IDs will absolutely clobber any other specificity, which is normally bad, except in one instance: when you need to sandbox styles for a component.
Right now, to do this, you can either:
- Wrap your component an in
<iframe>
& deal with 10x more problems. - Prefix your styles with an ID
#
and using something likenormalize.css
to reset all child elements.
This way, any existing styles on the page are pretty much guaranteed not to affect your component. This is ideal for when distributing a solution like:
Interesting in your thoughts!
There's an update here: https://github.com/RickWong/react-isomorphic-starterkit/blob/49e56b2263392b6682696599026de9b3ce8994d7/src/views/Style.jsx
Haven't had the time to update this package. Probably will have to rename it too since there's another package that goes by the same name.