KAG KAG - 1 year ago 88
React JSX Question

How to import the scss library into code so that the classes name does not change

I am working on reactjs project where we are using the scss.
I am facing issue with date picker. When I import the scss file of date picker into code. SCSS compiler will change the actual name of classes with some thing datepicker_dkfjkadjfklaj.

So here is there any way we can avoid the scss compile to change the name of classes and get the as it is into into DOM from file.

I heard some thing about the :global selectors but not sure how we can apply this.

I am using https://github.com/Hacker0x01/react-datepicker
Thank you in Advance !!!

Answer Source

Finally got it. global will work in this case.

Create an file like mystyle.scss and in which past the below code. Inside the scope of global past the all css of the datepicker. When page will render into DOM css will appear at it is without using the any post fix.

 /* css here */

I got the answer from https://github.com/JedWatson/react-select/issues/872

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download