I need purge a css file which have styles for multiple htmls, I have this script in my package.json:
"scripts":{
...
"postbuild": "purgecss --css build/styles/*.css --content build/*.html build/scripts/*.js --output build/styles"
....
}
but this only take the first file styles and the others are removed
I'm not sure I understand the situation correctly. Do you have a quick repo for me to produce the desire result?
I have the same problem. If I do something like this:
purgecss --config purgecss.config.js --css tailwind_styles.css --content options.js frame.js --output ./out/
It will effectively ignore frame.js.
when I use the flag --content with a wildcard like --content build/*.html purgecss just purge the css for the first html.
example:
index1.html:
<div class="class1"></div>
index2.html:
<div class="class2"></div>
both files have link to one file like this:
.class1{...}
.class2{...}
.class3{...}
.class4{...}
the output only have:
.class1{....}
spected:
.class1{....}
.class2{....}
I have the same problem with my repo (https://github.com/raravi/amithraravi2.com).
Running this command: purgecss --css _site/css/main.css --content _site/index.html _site/**/index.html _site/**/**/index.html _site/**/**/**/index.html dist/main.js --output dist/
Results in a purged file which keeps only content from the first 2 -> _site/index.html _site/**/index.html
For now, I've downgraded to 1.4.2, which seems to work as expected!
The documentation was not updated to reflect the changes.
The list of files should be comma separated.
purgecss --css build/styles/*.css --content build/*.html build/scripts/*.js --output build/styles
should be
purgecss --css build/styles/*.css --content build/*.html,build/scripts/*.js --output build/styles
and
purgecss --config purgecss.config.js --css tailwind_styles.css --content options.js frame.js --output ./out/
should be
purgecss --config purgecss.config.js --css tailwind_styles.css --content options.js,frame.js --output ./out/
Thank you! This worked!!
Most helpful comment
when I use the flag
--contentwith a wildcard like--content build/*.htmlpurgecss just purge the css for the first html.example:
index1.html:
index2.html:
both files have link to one file like this:
the output only have:
spected: