Open happysalada opened 3 years ago
The location that purgecss will look for your fonts is the location specified in your CSS (which you didn't include in your bug report above). Make sure that the font path specified in your initial CSS files (before any processing by postcss) is valid.
One good way to debug (I don't know your exact setup, so I can't offer more specific advice) is to run postcss without webpack, and see if that works. Then after confirming that works, figure out how to make sure that webpack is loading the proper font files. If that doesn't work, then it's a problem with postcss/plugin configuration (or a bug! please report more details if it is).
Without knowing more, that's the most I can say to help.
First of all, thanks a lot for taking time to read this!
Here is the inside of the font-awesome.css
file
@font-face {
font-family: 'Font Awesome 5 Free';
font-style: normal;
font-weight: 400;
font-display: auto;
src: url("/fonts/fa-regular-400.eot");
src: url("/fonts/fa-regular-400.eot?#iefix") format("embedded-opentype"),
url("/fonts/fa-regular-400.woff2") format("woff2"),
url("/fonts/fa-regular-400.woff") format("woff"),
url("/fonts/fa-regular-400.ttf") format("truetype"),
url("/fonts/fa-regular-400.svg#fontawesome") format("svg"); }
Running postcss with the following
npx postcss css -d postcss
I see that an empty fonts directory is being created.
I'm guessing that the fonts are not being found properly.
For information here is my directory layout
/css/font-awesome.css
/fonts/*.woff
postcss.config.js
the content of the font-awesome.css file is the one I pasted above.
Perhaps I have to use relative path in the css?
Or change the to
option in the plugin config.
Hi, thank you for the package!
I am running postcss and webpack together. I was hoping to use this package. It looks like purgefonts is not used in my pipeline even though I added to postcss. My postcss config is
(purgecss is just a custom purgecss config
I also have the following webpack config
Is there a way to debug why the fonts are not being purged? I'm also wondering if maybe the webpack font file loader is preventing this plugin from being run. My fonts are originally in css/webfonts. The file loader is putting them in /fonts. I'm guessing that is why the purgefonts can't find them.