How to access antd less variables when defining a css module for a component?

Viewed 276

I'm using customize-cra as suggested by antd documentation to be able to customize the theme and it works fine. I can access less variables from antd theme by importing the index in my less files and it works fine. I can use the old fashioned css modules to style my components by defining files with .module.css and it works fine. However, I would like to import and use the antd theme less variables in my css modules and I can't figure out how to make it work. Does anybody know how it can be achieved?

1 Answers

I am able to use the variables if I import antd.less at the top of the whatevercomponent.less file:

@import 'antd/dist/antd.less';
Related