Cannot be used correctly on ant-design
See original GitHub issueCannot be used correctly on ant-design. Will delete the associated style.
Describe the bug
before use:

after use:

code:
import 'antd/dist/antd.min.css';
import { Button } from 'antd';
...
<p>
<Button type='danger'>buy</Button>
</p>
config: ( use react-app-rewired on create-react-app )
const PurgecssPlugin = require('purgecss-webpack-plugin');
const glob = require('glob-all');
module.exports = function override(config, env) {
const purgecssPlugin = new PurgecssPlugin({
paths: ['./public/index.html', ...glob.sync(`./src/*`)],
});
if (env !== 'development') {
config.plugins = [...config.plugins, purgecssPlugin];
}
return config;
};
To Reproduce Steps to reproduce the behavior:
- Go to ‘…’
- Click on ‘…’
- Scroll down to ‘…’
- See error
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [e.g. Windows]
- Version of Purgecss [latest]
"glob-all": "^3.1.0",
"purgecss-webpack-plugin": "^1.4.0",
Additional context Add any other context about the problem here.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:19 (3 by maintainers)
Top Results From Across the Web
Ant design Form custom controls cannot be displayed correctly
I try to customize a form control named CheckGroup. According to the official document, I define two interfaces, value and onChange. When I...
Read more >FAQ - Ant Design
Here are the frequently asked questions about Ant Design and antd that you should look up before you ask in the community or...
Read more >show message validate error input once at a time ant design ...
How can I use AntD FormInstance functions correctly? Asked Sep 18, 2020 • 0 votes 1 answer. QUESTION ANSWERS.
Read more >ant-design/ant-design-english - Gitter
It feels like your rules prop is not defined correctly. prarjuna ... Hi, I am using https://ant.design/components/date-picker/ in my react application.
Read more >[Solved]-Ant design Form custom controls cannot be displayed ...
[Solved]-Ant design Form custom controls cannot be displayed correctly-Reactjs. Search. score:0. Accepted answer. <Form layout="vertical" initialValues={{ ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks a lot for the repo @Lizhooh , helped a lot.
This is what I came up with to make it work with ant-design, it is not an ideal solution but it should work.
I essentially added a path to the antd css file that I want to keep. in the example below,
button.To keep antd entirely, you could replace by
and wrote an extractor for css file that intend to get the selectors from the file:
I wonder what this would look like for a Next.js project 🤔