lunar icon indicating copy to clipboard operation
lunar copied to clipboard

How to disable global styles or remove "!important" of style rule

Open yinxin630 opened this issue 4 years ago • 4 comments

Hi, I import some third party stylesheets. But some styles not work becase of lunar has inject some global styles with !important

Such as image

If I force let globals to be null in here. My app will work well

So is there any general way to fulfill my needs?

yinxin630 avatar Apr 03 '20 07:04 yinxin630

@yinxin630 Important comes from Aphrodite and cannot be changed.

milesj avatar Apr 15 '20 02:04 milesj

Aphrodite has an option to override the automatic addition of !important: https://github.com/Khan/aphrodite/pull/104

BarthesSimpson avatar Apr 27 '20 03:04 BarthesSimpson

@BarthesSimpson While true, that functionality is abstracted away in Lunar so you wouldn't be able to control that.

milesj avatar Apr 27 '20 05:04 milesj

In your webpack config, add this alias:

...
  resolve: {
    alias: {
      aphrodite: 'aphrodite/no-important',
    },
  },
...

moyus avatar Oct 27 '20 09:10 moyus