1

How do I use purgecss, react, css-module in the vite 4.x project? I used @ fullhuman/postcss-purgecss, but I found it can't be used with css-module. Then I tried:

 {
 "scripts": {
    "postbuild": "purgecss --css build/static/css/*.css --content build/index.html build/static/js/*.js --output build/static/css"
 } 
},

However, I found that the js file compiled by vite contains all the classnames, whether they are used or not. This will invalidate the above command. So I want to ask how to do it now

I used @ fullhuman/postcss-purgecss, but I found it can't be used with css-module. purgecss delete all my css.

Then I tried:

 {
 "scripts": {
    "postbuild": "purgecss --css build/static/css/*.css --content build/index.html build/static/js/*.js --output build/static/css"
 } 
},

purgecss do nothing.

0 Answers0