Haseeb Ahmed
Haseeb Ahmed

Reputation: 643

Automatically suffix every style with !important

I'm making a widget in Angular 7 which will be put on different websites. I want this widget to get rid of all the styles which are being applied by that website and then use my own. For that, I'm using cleanslate (http://cleanslatecss.com/) but this means that all my styles will need to be prefixed by !important which I'm okay with because for now, this is the route I want to go (ShadowDOM doesn't work for me for various reasons).

What I wanted to know was, is there any webpack plugin or something else which I could use to suffix all my styles with the !important tag at the time of building?

Upvotes: 0

Views: 355

Answers (1)

user4676340
user4676340

Reputation:

!important is a bad practice, you should instead use CSS selector specificity.

You also have a all: unset property, which removes every CSS property from the element it is applied to.

Be careful about the support though.

Upvotes: 2

Related Questions